Sub MinSelected(R As Range)
Dim min As Double, tmp As String
min = Application.WorksheetFunction.min(R)
tmp = Application.WorksheetFunction.Text(min, "ddd/mm/dd/yyyy")
Range("F2").Select
ActiveCell = tmp
End Sub
Sub MaxSelectedd(S As Range)
Dim max As Double, tmp As String
max = Application.WorksheetFunction.min(S)
tmp = Application.WorksheetFunction.Text(max, "ddd/mm/dd/yyyy")
Range("G2").Select
ActiveCell = tmp
End Sub
Sub Main()
Dim myRange As Range
Set myRange = Selection
Module5.MinSelected (myRange)
MaxSelectedd (myRange)
End Sub
I'm fairly new to VBA and having some trouble with using Subs.
I'm trying to output min and max of the user selected range.
MinSelected
method is in Module 5, and Main
and MaxSelectedd
are in Module 6.
Object required
error occurs when I call Module5.Minselected(myRange)
.
Please help me figure out why.