Hello everyone,
I am trying to run the below code in order to loop through a few arrays and get the first value in each array, but, unfortunately it is not working.
The message box should display the values: "1", "4" and "7".
Thanks.
I am trying to run the below code in order to loop through a few arrays and get the first value in each array, but, unfortunately it is not working.
The message box should display the values: "1", "4" and "7".
Thanks.
VBA Code:
Dim allArrays As Variant, myArray1 As Variant, myArray2 As Variant, myArray3 As Variant, element As Variant
allArrays = Array("myArray1", "myArray2", "myArray3")
myArray1 = Array("1", "2", "3")
myArray2 = Array("4", "5", "6")
myArray3 = Array("7", "8", "9")
For Each element In allArrays
MsgBox element(1)
Next element