Thread: How to Question
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Sandy Sandy is offline
external usenet poster
 
Posts: 355
Default How to Question

Thank you. How can I find the lowest non zero (< 0) value and its position
in the array.


"Charles Chickering" wrote:

Sandy, I can do this with a loop but I'm not sure if this is the best way.
Dim dMin As Double
Dim lPostion As Long
Dim cnt As Long
dMin = SandyArr(LBound(SandyArr))
lPosition = LBound(SandyArr)
For cnt = LBound(SandyArr) to UBound(SandyArr)
If SandyArr(cnt) < dMin Then
dMin = SandyArr(cnt)
lPosition = cnt
End If
Next
MsgBox "The lowest value in Sandy's array is: " & dMin & _
vbCrLF & "And is in position: " & lPosition
--
Charles Chickering

"A good example is twice the value of good advice."


"Sandy" wrote:

I have an array with let's say 10 numeric values. How can I finf the lowest
non zero value and its position in the array.

Thank you