Trying to make an array that has two merged (so appending one array to another)
so far I have
Code:
'get one array and attach it to another array
Function appendArray(ByRef ArrayGrowth As Variant, ByRef arrayToAppend As Variant) As Long()
Dim arr() As Long
Dim x As Long, g As Long, y As Long, z As Long
g = UBound(ArrayGrowth) + UBound(arrayToAppend)
z = UBound(ArrayGrowth)
Debug.Print "Total: " & g
For x = 0 To g
ReDim Preserve arr(0 To x) As Long
If x >= z Then
arr(x) = arrayToAppend(y)
y = y + 1
Else
arr(x) = ArrayGrowth(x)
End If
Next
Debug.Print "count finished " & UBound(arr)
For x = 0 To UBound(arr)
Debug.Print arr(x)
Next
End Function
I'd like a better way - the major problem I have is it isn't counting the 0 in the array (the first value).