length of array
-
-
-
Re: length of array
Hi Aadarsh,
Try this:
[vba]
Ubound(array)
[/vba]HTH.
-
Re: length of array
Thanx
-
Re: length of array
The above solution doesn't work for zero-based arrays. Here's a complete example.
Code
Display MoreOption 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
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!