is there a way to use the WorksheetFunction.Min function

  • Thread starter Thread starter greg
  • Start date Start date
G

greg

is there a way to use the WorksheetFunction.Min function, But ignore 0's?

So for example
iFirst2 = 6
iFirst3 = 0
iFirst4 = 10
Excel.WorksheetFunction.Min(iFirst2, iFirst3, iFirst4)

I would like to get iFirst2 out. Not iFirst3.

Or is there an easy way to get this value?

thanks
 
You can do it in code easy enough...

Dim R As Range
Dim Min as Double
For Each R In Range("A1:A10")
If R.Value <> 0 Then
If R.Value < Min Or Min = 0 Then Min = R.Value
End If
Next
 
Back
Top