1,508 questions
Here is an example. Armed with this and the help file you should be able to figure it out.
'PROCEDURE:
' MaxValue
'PURPOSE:
' Using variants because user can pass in any data type.
' Example: myMax = MaxValue(1, 3.5, 5)
'ARGUMENTS:
' Any number of values (not an array)
'RETURNS:
' Variant
Public Function MaxValue(ParamArray varValue() As Variant) As Variant
Dim v As Variant
Dim vMax As Variant
If UBound(varValue) = -1 Then
vMax = Null 'Zero arguments passed in
Else
vMax = varValue(0)
For Each v In varValue
If v > vMax Then vMax = v
Next
End If
MaxValue = vMax
End Function