UBound Function |
UBound(arrayname[, dimension])
arrayname
Use: Required
The name of the array.
dimension
Use: Optional
Data Type: Variant (Long)
A number specifying the dimension of the array.
UBound returns a Long integer.
Indicates the upper limit of a specified dimension of an array. The upper boundary is the largest subscript you can access within the specified array.
If dimension isn't specified, 1 is assumed. To determine the upper limit of the first dimension of an array, set dimension to 1, to 2 for the second dimension, and so on.
The upper bound of an array dimension can be set using To, Dim, Private, Public, Redim, and Static, and can be set to any integer value.
Note that UBound returns the actual subscript of the upper bound of a particular array dimension
UBound is especially useful for determining the current upper boundary of a dynamic array.
The UBound function works only with conventional arrays. To determine the upper bound of a collection, retrieve the value of its Count property. To determine the upper bound of a control array or a menu control array, use the array's UBound property.