LBound function
Summary
Lower bound of array dimension.
Syntax
LBound(arrayname, [ dimension ])
The LBound function syntax has these parts:
Part
Description
arraynameRequired. Name of the array variable; follows standard variable naming conventions.
dimensionOptional; Variant (Long). Whole number indicating which dimension's lower bound is returned. Use 1 for the first dimension, 2 for the second, and so on. If dimension is omitted, 1 is assumed.
Part
Description
arraynameRequired. Name of the array variable; follows standard variable naming conventions.
dimensionOptional; Variant (Long). Whole number indicating which dimension's lower bound is returned. Use 1 for the first dimension, 2 for the second, and so on. If dimension is omitted, 1 is assumed.
Example
Example
This example uses the LBound function to determine the smallest available subscript for the indicated dimension of an array. Use the Option Base statement to override the default base array subscript value of 0.
Dim Lower
Dim MyArray(1 To 10, 5 To 15, 10 To 20) ' Declare array variables.
Dim AnyArray(10)
Lower = Lbound(MyArray, 1) ' Returns 1.
Lower = Lbound(MyArray, 3) ' Returns 10.
Lower = Lbound(AnyArray) ' Returns 0 or 1, depending on
' setting of Option Base.
This example uses the LBound function to determine the smallest available subscript for the indicated dimension of an array. Use the Option Base statement to override the default base array subscript value of 0.
Dim Lower
Dim MyArray(1 To 10, 5 To 15, 10 To 20) ' Declare array variables.
Dim AnyArray(10)
Lower = Lbound(MyArray, 1) ' Returns 1.
Lower = Lbound(MyArray, 3) ' Returns 10.
Lower = Lbound(AnyArray) ' Returns 0 or 1, depending on
' setting of Option Base.