UBound

This function determines the largest available subscript for the indicated dimension of an array.

Syntax

UBound(arrayname, [dimension])

Parameters

arrayname
Required. Name of the array variable; follows standard variable naming conventions.
dimension
Optional. Whole number that indicates which dimension's upper bound is returned. Use 1 for the first dimension, 2 for the second, and so on. If dimension is omitted, 1 is assumed.

Return Values

Returns a subscript.

Remarks

The Ubound function typically is used with Lbound to determine the size of an array. For Windows CE-based applications created with the toolkit, the lower bound for any dimension is always 0. The following code example and table shows how UBound returns values for an array.

Dim A(100,3,4)
Statement
Return Value
UBound(A,1) 100
UBound(A,2) 3
UBound(A,3) 4