View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default min value in range

This should do it

Function MyMin(minvaluerange)
Dim c
MyMin = 9.99999999999999E+307
For Each c In minvaluerange
If c < MyMin Then
MyMin = c
End If
Next c
End Function

But why not just use Excel's built-in function

Function mymin2(minvaluerange)
mymin2 = Application.Min(minvaluerange)
End Function

--

HTH

RP
(remove nothere from the email address if mailing direct)


"TxRaistlin" wrote in message
...
I am having a major problem with the application.worksheetfunction.min()
approach, and I believe it is b/c the range I am referencing is not

sorted,
and can not be for my application.

I have tried the following to find the minimum value in the range without
success:

Function MyMin(minvaluerange)
For Each c In minvaluerange
If c < c + 1 Then
MyMin = c
Else
MyMin = c + 1
End If
Next c
End Function


Help would be greatly appreciated.

Thanks,

Jason