Home ➜ VBA ➜ Top VBA Functions ➜ **VBA UBOUND Function (Syntax + Example)**

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

**Table of Content**Close

## Syntax

**UBound(ArrayName, [Dimension])**

## Arguments

**ArrayName**: The array for which you want to find the highest 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 UBOUND function, you need to go through the below example where we have written a vba code by using it:

```
Sub example_UBOUND()
Dim myAry(0 To 1100) As Double
Range("A1").Value = UBound(myAry, 1)
End Sub
```

In the above code, we have used the UBOUND to get the highest subscript for a dimension of the array “myAry” and it has returned 1100 in the result which is the highest value from 0 to 1100.