Is there an "append" operator or function in VBA for appending one array to another?
Thanks in advance,
Mike
Is there an "append" operator or function in VBA for appending one array to another?
Thanks in advance,
Mike
I am not familiar with Mac per se, but not that I know of.
You can redeclare the dimensions of an array to include the dimensions of the other..
Say you have:
[VBA]
Dim myArray()
Dim lngCount as Long
lngCount = range("A1")
ReDim myArray(1 to lngCount)
[/VBA]
Then you populate the redim'd array with potentially another array if needed
[VBA]
For x = 1 to UBound(MyArray)
MyArray(x) = 'something
Next x
[/VBA]
If you have posted the same question at multiple forums, please read this IMPORTANT INFO.
Please use the thread tools to mark your thread Solved
Please review the Knowledge Base
for samples and solutions , or to submit your own!
Hi Mike,
Short answer is no, not directly. In addition to XLGibbs post on ReDim, I'd add that you'll need to use the optional keyword "Preserve" in order to get the existing elements of your array saved during the ReDim process, otherwise, they'll get blown away.
to re-dimension the array A to 10 elements, saving the existing values.ReDim Preserve A(10)
Ed