+ Reply to Thread
Results 1 to 4 of 4

length of an array

  1. #1
    april27
    Guest

    length of an array

    is there any command (like in java) which gives you the length of an array?

  2. #2
    RB Smissaert
    Guest

    Re: length of an array

    Lookup UBound in the VBA help.

    Dim Arr(1 to 100) as String

    MsgBox UBound(Arr)

    This will give 100

    RBS

    "april27" <april27@discussions.microsoft.com> wrote in message
    news:B9ABDBED-7E55-445E-9B15-45C6CCBF59C4@microsoft.com...
    > is there any command (like in java) which gives you the length of an
    > array?



  3. #3
    Bob Phillips
    Guest

    Re: length of an array

    Use

    UBound(Arr) - LBound(Arr) + 1

    in case it doesn't start at 1.

    --
    HTH

    Bob Phillips

    (replace somewhere in email address with gmail if mailing direct)

    "RB Smissaert" <bartsmissaert@blueyonder.co.uk> wrote in message
    news:ujbjgW6kGHA.3440@TK2MSFTNGP02.phx.gbl...
    > Lookup UBound in the VBA help.
    >
    > Dim Arr(1 to 100) as String
    >
    > MsgBox UBound(Arr)
    >
    > This will give 100
    >
    > RBS
    >
    > "april27" <april27@discussions.microsoft.com> wrote in message
    > news:B9ABDBED-7E55-445E-9B15-45C6CCBF59C4@microsoft.com...
    > > is there any command (like in java) which gives you the length of an
    > > array?

    >




  4. #4
    Tom Ogilvy
    Guest

    Re: length of an array

    a more general determination for a single dimension:

    Dimensionsize = Ubound(a) - lbound(a) + 1

    --
    Regards,
    Tom Ogilvy

    "RB Smissaert" wrote:

    > Lookup UBound in the VBA help.
    >
    > Dim Arr(1 to 100) as String
    >
    > MsgBox UBound(Arr)
    >
    > This will give 100
    >
    > RBS
    >
    > "april27" <april27@discussions.microsoft.com> wrote in message
    > news:B9ABDBED-7E55-445E-9B15-45C6CCBF59C4@microsoft.com...
    > > is there any command (like in java) which gives you the length of an
    > > array?

    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1