UBound Function

Syntax

UBound(arrayvar[, dimension])

Group

Variable Info

Description

Returns the highest index.

Parameters

Parameters Description
arrayvar Returns the highest index for this array variable.
dimension Returns the highest index for this dimension of arrayvar. If this is omitted, it returns the highest index for the first dimension.

Example


Sub Main
    Dim A(3,6)
    Debug.Print UBound(A)   ' 3
    Debug.Print UBound(A,1) ' 3
    Debug.Print UBound(A,2) ' 6 
End Sub

See also

LBound( )