Excel VBA UBound Function: The UBound function in VBA returns the highest subscript for the specified dimension in the given array.

Syntax

Parameter

ArrayName (required) – This parameter represents an array for which you want to find the highest subscript.

Dimension (optional) – This parameter specifies the dimension of the array, for which you require the highest subscript. By default, this parameter is set to 1.

Return

This function returns the highest subscript for the specified dimension in the given array.

Example 1

Output

9

VBA UBound Function

Example 2

Output

10

20

VBA UBound Function

Pin It on Pinterest

Share This