How to Question
how about this? it sorts the array and the lowest number will be arr(0)
modified from someone's code here
Sub sort_array()
Dim arr As Variant
Dim i As Long, j As Long, temp As Long
'sort the array
arr = Array(2, 3, 4, 1, 6, 8,7)
For i = LBound(arr) To UBound(arr) - 1
For j = i + 1 To UBound(arr)
If arr(i) arr(j) Then
temp = arr(j)
arr(j) = arr(i)
arr(i) = temp
End If
Next j
Next i
MsgBox arr(0)
End Sub
--
Gary
"Sandy" wrote in message
...
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
|