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!

Hi All Sorry to be a pain on thi

Status
Not open for further replies.

ninash

Technical User
Jul 6, 2001
163
GB
Hi All

Sorry to be a pain on this thread but is there a way of making this code continue listing positions of an unknown number of units...
Eg. I have 25 numbers all of which I need to mark with a position. However next week it might be 20
 
Whoops.... forgot the code
It came from Skip at this site

Function WhatMax(Position, ParamArray x())
Dim m1, m2, m3, tmp
For i = LBound(x, 1) To UBound(x, 1)
If x(i) > m1 Then
m3 = m2
m2 = m1
m1 = x(i)
Else
If x(i) > m2 And x(i) <> m1 Then
m3 = m2
m2 = x(i)
Else
If x(i) > m3 And x(i) <> m2 Then
m3 = x(i)
End If
End If
End If
Next
Select Case Position
Case 1
WhatMax = m1
Case 2
WhatMax = m2
Case 3
WhatMax = m3
Case Else
WhatMax = &quot;Tilt!&quot;
End Select
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top