VBA Array Length / Size

Associated Files Download Links

This tutorial will teach you how to get the length (size) of an Array in VBA.

Get Array Length

In order to get the length of an Array, you need to know the array’s start and end positions. You can do this with the VBA’s UBound and LBound Functions.

LBound and UBound Functions

This procedure demonstrates how to use the UBound and LBound Functions on a a single dimension array:

Subtracting the two will give you the array length (UBound – LBound +1).

Get Array Length Function

This function will calculate the size (length) of a single-dimensional Array:

Get 2D Array Size

This function will calculate the number of positions in a two-dimensional array: