UBound function
Returns the maximum number of available subscripts for the specified array dimension.
UBound(arrayname[, dimension])
Parameters
Arrayname
Required option. The name of the array variable, followed by the standard variable naming convention.
Dimension
Options available. An integer that specifies which dimension upper bound is returned. 1 represents the first dimension, 2 represents the second dimension, and so on. If the dimension argument is omitted, the default value is 1.
Description
The UBound function is used in conjunction with the LBound function to determine the size of the array. You can use the LBound function to determine the lower bound of one dimension of an array.
The lower bounds of all dimensions are 0. For arrays with such dimensions, theUBound function returns the following result:
Dim A(100,3,4)
Statement |
return value |
UBound (A, 1) |
100 |
UBound (A, 2) |
3 |
UBound (A, 3) |
4 |