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 = "Tilt!"
End Select
End Function
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.