How to use the VBA LBOUND Function (Syntax + Example)

The VBA LBOUND function is listed under the array category of VBA functions. When you use it in a VBA code, it can return the lowest subscript for a dimension of the array supplied. In simple words, it helps you to find the lower limit of an array, by returning the lowest value in the result.

Syntax

LBound(ArrayName, [Dimension])

Arguments

  • ArrayName: An array for which you want to find the lowest subscript.
  • [Dimension]: An integer to define the dimension of the array [This is an optional argument and if omitted VBA takes 1 by default].

Example

To practically understand how to use VBA LBOUND function, you need to go through the below example where we have written a vba code by using it:

Sub example_LBOUND()
Dim myAry(0 To 1100) As Double
Range("A1").Value = LBound(myAry, 1)  
End Sub

In the above code, we have used the LBOUND to get the lowest subscript for a dimension of the array myAry and it has returned 0 in the result.

Related Functions

ARRAY | FILTER | JOIN | SPLIT | UBOUND