Concatenating variant arrays in Excel VBA


I would like to concatenate 2 variant arrays in Excel VBA for use in a For loop.  The first array is basically the n-1 index for the array that I would like to create in the For loop.  I have this working in Matlab which I am much more familiar with but need to get this into my Excel VBA code.

My incomplete VBA code is as follows:
Dim numTimes As Integer
Dim area As Double
Dim endTime As Double
    numTimes = Range("B2").Value    'This value is equal to 8
    area = Range("B6").Value    'This value is equal to 150
    endTime = 200

Dim TmpArr() As Variant
ReDim TmpArr(1 To numTimes)
    TmpArr(1) = area/2
    TmpArr(2) = area + 1.25
For idx1 = 3 To numTimes
    TmpArr(idx1) = TmpArr(idx1 - 1) + 25.125
Next idx1

' Need to concatenate tmpArr here with some preallocated array (to be created)
' array of size (numTimes x endTime-1) then perform For loop

Open in new window

If it would be helpful to understand what I am aiming for, my Matlab code is as follows:
numTimes = 8;
area = 150;
endTime = 200;

tmpArr = zeros(numTimes,1);
tmpArr(1) = area/2;
tmpArr(2) = area + 1.25;

for idx1 = 3:numTimes
   tmpArr(idx1) = tmpArr(idx1-1) + 25.125; 

arr = [tmpArr zeros(numTimes, endTime-1)];
for idx2 = 2:1:endTime
    isFast = arr(:,idx2-1) > 0 & arr(:,idx2-1) < (200-area);
    dR = (2.*isFast + 0.5.*(~isFast));
    arr(:,idx2) = mod(arr(:,idx2-1) + dr,200);

Open in new window

I have verified that what I am getting out of TmpArr in VBA matches what I want and get out of the Matlab code for tmpArr.

Any help would be greatly appreciated!
Michelle MAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can Redim Preserve the TmpArr array, increasing its size, and then populate it with the data from the second array.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.