What is VBA LBOUND Function
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.
how to use it
To use VBA's LBOUND function you need to understand its syntax and 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 use LBOUND Function in VBA
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.
About the Author
Puneet is using Excel since his college days. He helped thousands of people to understand the power of the spreadsheets and learn Microsoft Excel. You can ﬁnd him online, tweeting about Excel, on a running track, or sometimes hiking up a mountain.