LBound Function
Language Items List
Definition:
Returns the smallest usable subscript for the supplied array dimension.
Syntax:
LBound(array [,dimension]}
Syntax Description
array Array variable name.
dimension Integer indicating the dimension for which you want the lower bound returned,
optional. Enter 1 to specify the first dimension, 2 for the second dimension,
and so on. If you omit dimension, the first dimension is assumed.
Details:
Use LBound to find the lower bound of and array dimension and UBound to find
the upper bound. These two functions are often used together to determine the
size of a dynamic array. To determine the array size, use the following equation:
UBound return value - LBound return value + 1 =number of elements in this
dimension.
The lower bound for any dimension defaults to 0. Arrays for which dimensions
are set using the To clause in a Dim or ReDim statement can have a lower bound
of any integer value. Use the UBound function to find the upper limit of an
array dimension.
The following table shows the values LBound would return for an array with the
specified dimensions:
Dim A(1 To 10, 0 To 5, -6 To 8)
Statement Return Value
LBound(A,1) 1
LBound(A,2) 0
LBound(A,3) -6
See Also:
Dim Statement
ReDim Statement
Static Statement
UBound Function