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
There are currently 3 users browsing this thread. (0 members and 3 guests)