ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   is there a way to use the WorksheetFunction.Min function (https://www.excelbanter.com/excel-programming/426698-there-way-use-worksheetfunction-min-function.html)

greg

is there a way to use the WorksheetFunction.Min function
 
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



Rick Rothstein

is there a way to use the WorksheetFunction.Min function
 
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

--
Rick (MVP - Excel)


"greg" wrote in message
...
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




All times are GMT +1. The time now is 05:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com