Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 4 of 4

Thread: length of array

  1. #1
    Join Date
    12th January 2005
    Location
    Singapore
    Posts
    201

    length of array

    how do i find the length of an array, which has been declared as

    VB:
    Dim abcarray() As Variant 
    
    

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    6th December 2004
    Posts
    181

    Re: length of array

    Hi Aadarsh,

    Try this:
    VB:
    UBound(array) 
    
    
    HTH.
    Pradeep

  3. #3
    Join Date
    12th January 2005
    Location
    Singapore
    Posts
    201

    Re: length of array

    Thanx

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    19th April 2008
    Posts
    6

    Re: length of array

    The above solution doesn't work for zero-based arrays. Here's a complete example.

    VB:
    Option Base 0 'Un-comment for zero-based arrays
     'Option Base 1   'Un-comment for one-based arrays
     
    Sub ShowArrayLen() 
        Dim abcarray() As Variant 
         
        Redim abcarray(3) 'i.e. some run-time array size value
         
        MsgBox "Range: " & LBound(abcarray) & " to " & UBound(abcarray) 
        MsgBox "Length: " & UBound(abcarray) - LBound(abcarray) + 1 
        MsgBox "Ubound: " & UBound(abcarray) 'does not = length for zero-based arrays!
    End Sub 
    
    

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Replies: 2
    Last Post: August 10th, 2006, 18:05
  2. Length max value and it index in an array
    By ditzafar in forum EXCEL HELP
    Replies: 4
    Last Post: June 7th, 2006, 02:42
  3. VLookup Length
    By dochie in forum EXCEL HELP
    Replies: 5
    Last Post: January 25th, 2006, 03:04
  4. Replies: 1
    Last Post: May 17th, 2005, 08:45
  5. Cell length
    By depesh in forum EXCEL HELP
    Replies: 1
    Last Post: October 26th, 2004, 20:12

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
  •  
porno