VBA Function: Array
The VBA function Array returns an array containing the values passed as arguments.
Usage:
Array(value_0, value_1, value_2, etc.)
Example of Usage
Using the Array function to obtain an array with specified values:
Sub example()
'Array composed of 3 elements
myArray = Array("www", "excel-pratique", "com")
'Displaying individual elements
MsgBox myArray(0) 'Returns: www
MsgBox myArray(1) 'Returns: excel-pratique
MsgBox myArray(2) 'Returns: com
'Displaying all elements of the array (separated by a ".")
MsgBox Join(myArray, ".") 'Returns: www.excel-pratique.com
End Sub