View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default How to combine arrays?

Sub test()
Dim A3 As Variant

A1 = Array(3, 12, 8)
A2 = Array(6, 1, 0, 9)

A3 = A1
Size = UBound(A3) + 1
ReDim Preserve A3((Size + UBound(A2)))

For i = 0 To Size
A3(Size + i) = A2(i)
Next i


End Sub

"Georg" wrote:

How do I combine two one-dimensional arrays to one new one-dimensional array?
E.g. if A1 is one-dimensional (3, 12, 8) and A2 is one-dimensional (6, 1, 0,
9) I want the resulting array to be (3, 12, 8, 6, 1, 0, 9). Thanks for help!
Georg