|
-
May 20th, 2002, 12:25 AM
#1
Thread Starter
Frenzied Member
Max Element Of Array
I need a function which, when passed a long array, returns the highest element.
-
May 20th, 2002, 12:40 AM
#2
You mean
dim j as integer
j = UBound(arrayname)
debug.print arrayname(j)
?
-
May 20th, 2002, 01:05 AM
#3
Thread Starter
Frenzied Member
No. I meant the highest value not subscript. It's Ok. I found what I was looking for in a previous thread.
-
May 20th, 2002, 01:09 AM
#4
(Ned Flander's impression)
Okilley Dokilley
(/Ned FLander's impression)
-
May 20th, 2002, 03:03 AM
#5
Member
Try this function:
Private Function MaxElement(a())
el = LBound(a)
Max = a(el)
For i = LBound(a) To UBound(a)
If a(i) > Max Then
Max = a(i)
el = i
End If
Next
MaxElement = el
End Function
It's not working? Don't be discouraged. Try a bigger hammer!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|