VBA Array UBound Function in Excel. Let us see about VBA arrays Upper Bound or UBound function in Excel VBA. The UBound function represents the Upper Bound value of an array. It returns the highest subscript(Index) value of specified array. It helps to determine the existing an array end size.
Here is the Syntax of the UBound Function in Excel VBA.
Where ArrayName: It is a mandatory argument. The ArrayName argument represnts the name of an array.
Dimension: It is an optional parameter. The Dimension argument represents the dimension of an array.
Let us see the example for VBA Upper Bound function in Excel.
'VBA UBound Function Sub VBA_UBound_Function() 'Declare an array variable Dim sWeekDays As Variant 'Define an Array values sWeekDays = Array("North", "East", "West", "South") 'Find Array Upper Bound MsgBox "Upper Bound Value is :" & UBound(sWeekDays), vbInformation, "VBAF1" End Sub
Here is the output screen shot of above macro.
You can refer the following link for the step by step instructions.
Click on the following links of the useful resources. These helps to learn and gain more knowledge.