Results 1 to 2 of 2

Thread: Please help a novice with this simple question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    71
    EASY EASY EASY but I am a novice!
    I have an array of long numbers. I need to find the maximum value of this array


    Here is the info:

    dim lngMyNumb() as long
    dim i as integer

    i =3

    redim lngmynumb(i)
    lngmynumb(0) = 1
    lngmynumb(1) = 2
    lngmynumb(2) = 3
    lngmynumb(3) = 4

    I need something like Max(lngMyNumb(i))
    Help!!!! Max(lngMyNumb(i)) doesn't work.

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    Dim lngMyNumb() As Long
    Dim lngMax As Long
    Dim i As Integer

    i = 3

    ReDim lngMyNumb(i)
    lngMyNumb(0) = 44
    lngMyNumb(1) = 66
    lngMyNumb(2) = 99999
    lngMyNumb(3) = 123

    For i = 0 To UBound(lngMyNumb)
    If lngMyNumb(i) > lngMax Then
    lngMax = lngMyNumb(i)
    End If
    Next

    MsgBox "Max is " & lngMax

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width