Reputation: 67
Suppose there are two 1D arrays each of them contains 3 elements as follow
A 1
2 3
B C
How does one concatenate the two arrays into a single array with elements
A1
23
BC
It's easy to do that in sheet operation by using either & or CONCATENATE function, but how to do this in array?
Upvotes: 1
Views: 93
Reputation: 152585
Iterate through the array and combine them into a third:
Sub foooooo()
Dim arr1() As Variant
Dim arr2() As Variant
Dim outArr() As Variant
arr1 = Array("A", "2", "B")
arr2 = Array("1", "3", "C")
ReDim outArr(UBound(arr1))
For i = LBound(arr1) To UBound(arr1)
outArr(i) = arr1(i) & arr2(i)
Next i
Debug.Print Join(outArr, ",")
End Sub
Upvotes: 1