GBAccess said:
That's what I thought, but when I tried that I wind up with a null value
out
of 3 possible values:1,3 & 5. Any ideas why?
Here's how it looks if this helps (by the way, thank you for helping me
out!)
Function MyMin(ParamArray Values()) As Variant
Dim intLoop As Integer
Dim varMin As Variant
If IsMissing(Values) Then
MyMin = Null
Else
For intLoop = LBound(Values) To UBound(Values)
If varMin > Values(intLoop) Then
varMin = Values(intLoop)
End If
Next intLoop
MyMin = varMin
End If
End Function
I overlooked that we're starting with a Null value in varMin, which won't
compare to anything. We'd probably also do well to allow for possible Null
values in the argument list. Try this version:
'------ start of code ------
Function MyMin(ParamArray Values()) As Variant
Dim intLoop As Integer
Dim varMin As Variant
Dim ListVal As Variant
If IsMissing(Values) Then
MyMin = Null
Else
varMin = Null
For intLoop = LBound(Values) To UBound(Values)
ListVal = Values(intLoop)
If Not IsNull(ListVal) Then
If IsNull(varMin) Then
varMin = ListVal
Else
If varMin > ListVal Then
varMin = ListVal
End If
End If
End If
Next intLoop
MyMin = varMin
End If
End Function
'------ end of code ------