Sorry for interrupting the thread.
By the way, I have some suggestions. As I know that Excel Max function
is not the fastest way to utilize in vba code.
Let say you have an array named Prog(size)
The following sub will do the job you want. I assume that you have an
array of integers.
Option Base 1
Sub getMax(tArray as Variant) As Integer
Dim size As Integer, i As Integer
Dim maxVal As Integer
maxVal = 0 ' defalt return value
size = UBound(tArray)
If size0 then
maxVal = tArray(1)
If size2 then
For i = 2 to size
If tArray(i)maxVal then maxVal = tArray(i)
Next i
End If
End If
getMax = maxVal
End Sub
There is another way is that you can sort the array acsendingly then get
the last element which is the largest one. I have a sub to do this task
that can be posted if you like.
Hope you find this useful.
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!