Excel VBA IsArray Function

VBA IsArray Function: The IsArray function in VBA returns a Boolean, showing whether the given variable is an Array or not.

Syntax

IsArray (VarName)

Parameter

VarName (required)- This parameter represents the variable that you want to test.

Return

This function returns a Boolean value TRUE if the specified variable is an Array else it returns False.

Example 1

Sub IsArray_Example3()
 Dim names(5) As String
 Dim is_Array As Boolean
 is_Array = IsArray(names)
 ' The variable will return True.
 Cells(1, 1).Value = "The is_Array will return"
 Cells(1, 2).Value = is_Array
 End Sub 

Output

The is_Array will return TRUE

Example 2

Sub IsArray_Example2()
 Dim Vals() As Integer
 Dim is_Array As Boolean
 is_Array = IsArray(Vals)
 ' The variable will return True.
 Cells(1, 1).Value = "The is_Array will return"
 Cells(1, 2).Value = is_Array
 End Sub 

Output

The is_Array will return TRUE