UBound Function

Returns the number of items in an array expression.

UBound (array [, dimension] )

Parameters

Array  -  (Input, expression, Required)

Specifies the array expression to check.

Dimension  -  (Input, expression, Optional)

Specifies which dimension’s size is returned. Use 1 for the first dimension, 2 for the second dimension, and so on. If dimension is omitted, 1 is assumed.

Return Value

The number of items in the array expression.

Examples

UBound(1,1)

Returns False 

SetValue(temp, 1)

UBound(temp)

Returns Error

 

SetValue(tempArrray(0), 1)

SetValue(tempArray(5), 1)

UBound(tempArray)

Returns 6

SetValue(tempArrray(0), 1)

SetValue(tempArray(5), 1)

UBound(tempArray, 2)

Returns 0

SetValue(tempArray(0,0), 1)

SetValue(tempArray(6,7), 1)

UBound(tempArray, 2)

Returns 8

 

UBound(Error)

Returns Error

TIP:

Functions are specifically for use in the Macro Editor. Refer to Microsoft's official VB and JScript documentation for scripting equivalents.

See Also

Functions | Asc function | Chr function | CSet function | Format function | InStr function | LCase function | Left function | Len function | LSet function | LTrim function | Mid function | Replace function | Right function | RSet function | RTrim function | Space function | String function | TCase function | Trim function | UBound function | UCase function


© 2004-2021 looksoftware. All rights reserved.