LBound Function
Returns the smallest available subscript for the indicated dimension of an array.
Syntax
LBound (arrayname[, dimension])
Arguments:
- Arrayname: Name of the array variable; follows standard variable naming conventions.
- Dimension: 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.
Remarks
The LBound function is used with the UBound
function to determine
the size of an array. Use the UBound
function to find the upper
limit of an array dimension.
The lower bound for any dimension is always 0.
The following examples illustrate the use of LBound
function:
Example:
Dim food(1,2)
food(0,0)="Apple"
food(0,1)="Banana"
food(0,2)="Orange"
food(1,0)="Pizza"
food(1,1)="Hamburger"
food(1,2)="Spaghetti"
LBound(food) 'Output with default Dimension -> 0
LBound(food,1) 'Output for Dimension 1 -> 0
LBound(food,2) 'Output for Dimension 2 -> 0