Returns the upper bound of an array's dimension
Syntax
Usage
result = UBound( array [, dimension ] )
Parameters
array
an array of any type
dimension
the dimension to get upper bound of
Return Value
Returns the upper bound of an array's dimension.
Description
UBound returns the largest value that can be used as an index into a particular dimension of an array.
Array dimensions are numbered from one (1) to n, where n is the total number of dimensions. If dimension is not specified, UBound will return the upper bound of the first dimension. If dimension is less than one (1) or greater than the total number of dimensions (n) in the array, the result is undefined.
Example
Dim array(-10 To 10, 5 To 15, 1 To 2) As Integer
Print UBound(array) 'returns 10
Print UBound(array, 2) 'returns 15
Print UBound(array, 3) 'returns 2
See also