ARRAYDIMENSION (for use in VBA)

Returns the number of dimension of an array variable.
This function is for use in VBA. This is very useful to determine the dimension of an array.

Syntax

ARRAYDIMENSION(array_variable)

array_variable is the array you want to find out what the dimension is.

Example

To call this function in VBA:

Dim a as integer
Dim v
Dim v2

Redim v(5) ‘an array with 5 slots
Redim v2(5,2) ‘an array with 5 rows and 2 columns

a = Application.Run(“ArrayDimension”, v)
b = Application.Run(“ArrayDimension”, v2)

In the above code, a returns 1 and b returns 2.