Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

personal Excel function 1

Status
Not open for further replies.

iamapollo

MIS
Aug 22, 2001
38
AU
Hi

I would like to build a function similar to the Min function that finds the minimum of a set of numbers excluding zeros. What I am unsure of is how to pass in a cell reference of the type a3:g3 like if you were using the actual min function. Would you pass this in as a variant and then access like an array?

Thanks for any help

Michael
 
inser a new module and this code on it
Public Function fnMin(rngIn As Range)
Dim i As Range, myMin
For Each i In rngIn
If Not IsError(i.Value) Then
If i.Value <> &quot;&quot; And (i.Value < myMin Or IsEmpty(myMin)) Then myMin = i.Value
End If
Next i
fnMin = myMin
End Function
'***************************************************************************

you can pass the reference to your function as a range
ide
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top