Results 1 to 5 of 5

Thread: Array Help

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2006
    Posts
    29

    Array Help

    Is there a way to find out if a subscript is out of range in an array?

  2. #2

  3. #3
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: Array Help

    Yep, use LBound() and UBound() to determine the valid subscript range.

  4. #4
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: Array Help

    Code:
        If YourSubscript < LBound(TheArray) Or YourSubscript > UBound(TheArray) Then
            MsgBox "Out of Range", vbExclamation
        End If

  5. #5
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628

    Re: Array Help

    Assuming that's what you meant, you can also use those commands with multi-dimensioned arrays.
    [code]
    dim MyArray(5, 13) as boolean
    msgbox ubound(myarray, 2)
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

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