UBound Function

Returns the largest available subscript for the indicated dimension of an array.

Syntax
UBound (arrayName [, dimension])

Parameters

arrayName
Name the variables according to the standard naming rules.
dimension
Set the dimension that returns the maximum value of the element number with the following integer value. If dimension is omitted, 1 is assumed.

  • 1 for the first dimension
  • 2 for the second dimension
  • 3 for the third dimension

See Also
Redim

UBound Function Example

Integer i, a(10)

For i=0 to UBound(a)
    a(i) = i
Next