UBound Function
Updated: September 2009
Returns the largest available subscript for the indicated dimension of an array.
UBound(arrayname[, dimension])
The UBound function is used with the LBound Function to determine the size of an array. LBound returns 0 because the lower bound for any dimension is always 0. Therefore, the length of a dimension is one greater than the output of the UBound function.
The following table shows the values returned by various UBound statements when they are applied to an array that has these dimensions:
Dim A(100,5,4)
|
Statement |
Return value |
|---|---|
|
UBound(A, 1) |
100 |
|
UBound(A, 2) |
5 |
|
UBound(A, 3) |
4 |
Community Additions
Show: