Joining two arrays to become a new array

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I need some help for joining two arrays to become a new array.
For example I have two arrays:
A=Array("a","b","c")
B=Array("d","e","f")

C will be the array that joining A and B.
C = Array("a","b","c","d","e","f")

What operator or function I should in order to get this done?
Thanks.
 
Dim a
a = Array("a", "b", "c")

Dim b
b = Array("d", "e", "f")
Dim c

Dim counter
counter = UBound(a) + 1 + UBound(b) + 1

ReDim c(counter - 1)

Dim i
For i = 0 To UBound(a)
c(i) = a(i)
Next

Dim j
j = 0
For i = (UBound(a) + 1) To counter - 1
c(i) = b(j)
j = j + 1
Next
 
Back
Top