UBound Function

Syntax

UBound(arrayname[, dimension])


arrayname

Use: Required

The name of the array.


dimension

Use: Optional

Data Type: Variant (Long)

A number specifying the dimension of the array.

Return Value

UBound returns a Long integer.

Description

Indicates the upper limit of a specified dimension of an array. The upper boundary is the largest subscript you can access within the specified array.

Rules at a Glance

  • If dimension isn't specified, 1 is assumed. To determine the upper limit of the first dimension of an array, set dimension to 1, to 2 for the second dimension, and so on.

  • The upper bound of an array dimension can be set using To, Dim, Private, Public, Redim, and Static, and can be set to any integer value.

Programming Tips and Gotchas

  • Note that UBound returns the actual subscript of the upper bound of a particular array dimension

  • UBound is especially useful for determining the current upper boundary of a dynamic array.

  • The UBound function works only with conventional arrays. To determine the upper bound of a collection, retrieve the value of its Count property. To determine the upper bound of a control array or a menu control array, use the array's UBound property.

See Also

LBound Function
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.204.247