VBA Array UBound Function in Excel

VBA Array UBound function

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.

Syntax of the UBound Function

Here is the Syntax of the UBound Function in Excel VBA.

UBound(ArrayName,[Dimension])

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.
VBA Array Ubound function

Example for VBA UBound Function in Excel

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.

VBA UBound Function

Instructions to Run VBA Macro Code or Procedure:

You can refer the following link for the step by step instructions.

Instructions to run VBA Macro Code

Other Useful Resources:

Click on the following links of the useful resources. These helps to learn and gain more knowledge.

VBA Tutorial VBA Functions List VBA Arrays VBA Text Files VBA Tables

VBA Editor Keyboard Shortcut Keys List VBA Interview Questions & Answers Blog

8 thoughts on “VBA Array UBound Function in Excel”

  1. It is tгuly a great and useful piece of info. I’m satisfied that you simply shared this helpful information with
    us. Pleaѕe keep us up to date like this. Thank y᧐u fοr sharing.

  2. accountant freelancer

    I used to be suggested this website via my cousin. I am now not sure whether or not this put up
    is written via him as no one else recognize such specified about my difficulty.

    You’re incredible! Thank you!

  3. Pingback: Neha

  4. Pingback: Google

Leave a Comment