G
Greg Maxey
Jonathan West posted the following for my benefit:
"Greg, As for getting a max from an array, something like this should work
Function MaxOfArray(vArray() as Variant) As Variant
Dim iStart as Long
Dim iEnd as Long
Dim vMax as Variant
Dim i As Long
iStart = LBound(vArray)
iEnd = UBound(vArray)
vMax = vArray(iStart)
For i = iStart + 1 to iEnd
If vArray(i) > vMax Then vMax = vArray(i)
Next i
MaxOfArray = vMax
End Function"
I really need help understanding arrays, passing arguements, and in
particular the understanding the empty parens "()" in Jonathans code (e.g.
vArray() As Variant).
Lets say I have the following numbers "1 99.99 -34.3 and 50" and I want to
"pass" them to Jonathans function to get a returned answer of "99.99."
What would the approptiate calling statement be? How is (vArray() As
Variant)
determined?
All help appreciated. Thanks.
P.S - Sorry for the double post in the customization newsgroup.
"Greg, As for getting a max from an array, something like this should work
Function MaxOfArray(vArray() as Variant) As Variant
Dim iStart as Long
Dim iEnd as Long
Dim vMax as Variant
Dim i As Long
iStart = LBound(vArray)
iEnd = UBound(vArray)
vMax = vArray(iStart)
For i = iStart + 1 to iEnd
If vArray(i) > vMax Then vMax = vArray(i)
Next i
MaxOfArray = vMax
End Function"
I really need help understanding arrays, passing arguements, and in
particular the understanding the empty parens "()" in Jonathans code (e.g.
vArray() As Variant).
Lets say I have the following numbers "1 99.99 -34.3 and 50" and I want to
"pass" them to Jonathans function to get a returned answer of "99.99."
What would the approptiate calling statement be? How is (vArray() As
Variant)
determined?
All help appreciated. Thanks.
P.S - Sorry for the double post in the customization newsgroup.