VBA Array IsArray function in Excel checks whether the specified input variable is an array or not. It returns a boolean value. The specified input variable is an array then returns True, otherwise returns False. Let us examples in the following tutorial.
Syntax of the VBA Array IsArray Function
Here is the Syntax of the IsArray Function in Excel VBA.
IsArray(VarName) As Boolean
Where VarName: It is a mandatory argument. The VarName argument represents a variable to be checked.
Example1: VBA IsArray Function in Excel
Let us see the vba macro code to check variable is an array or not. In the following example the specified variable an array variable. So, It returns output as TRUE.
'VBA IsArray Function Sub VBA_IsArray_Function() 'Declare an array variable Dim sWeekDays As Variant 'Define an Array values sWeekDays = Array("North", "East", "West", "South") 'Find Array Upper Bound MsgBox "Variable(sWeekDays) is an Array or Not: " & isarray(sWeekDays), vbInformation, "VBAF1" End Sub
Here is the output screenshot of above macro code.
Example2: VBA IsArray Function in Excel
Here is one more example VBA macro code to check variable is an array or not. In the following example the specified variable is not an array variable. So, It returns output as FALSE.
'VBA IsArray Function Sub VBA_IsArray_Function_Ex() 'Declare an array variable Dim sInput As String 'Define an Array values sInput = "VBAF1" 'Find Array Upper Bound MsgBox "Variable(sInput) is an Array or Not: " & isarray(sInput), vbInformation, "VBAF1" End Sub
Let us see the output screenshot of above macro code.
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