i have a function appendarray() which adds 2 one dim array and returns an array
for examples if array 1 contains 1,2,3 and array 2 contains 4,6,7 it returns an
array 1,2,34,6,7. It works well.

Now i have a requirement that i want to append an empty array into array 1 . Now
this give error. can anyone help?

Function appendarray(array1 As Variant, array2 As Variant) As Variant
Dim array3() As Variant
x = UBound(array1, 1) + UBound(array2, 1)
u = UBound(array1, 1)
ReDim array3(1 To x) As Variant
For i = 1 To u
array3(i) = array1(i)
Next i
For i = u + 1 To x
j = i - u
array3(i) = array2(j)
Next i
appendarray = array3
End Function


I need to add empty array into an array for an usage in looping
as below

array1=appendarray(array1,array2)

initially array 1 will be empty but after every looping it will get added.

imagine array2 is a range from cells(1,1) to cells(100,1) where in every loop
sheet no.changes by sheet(i) where i is a variable. So all the first column data
from 1 st row to 100 th row will be added