How to Expand Array by appending another elements to it

Copper Contributor

Hello all. This is my 2nd post!

 

Can anyone show me a good VBA script or a formula not using VBA that will create a new array with the contents of one array in addition to the contents of another array or a single cell value?

 

For example, if i have an array of {1,2,3}, how do I expand that array and add in a value of say 5 from say cell A2 to create a new array {1,2,3,5}. Would also like to know how I would do it if I need to add more than just a single value. Say I want to add {5,2} to make the new array now {1,2,3,5,2}.

 

I've tried a few VBA functions/sub routines online, but I can't seem to get a satisfactory output. Any and all suggestions are appreciated.

 

 

3 Replies
I had read that Sergei, thank you for the reference. I was looking for something a little less complicated, but if that's the only way to do it, I guess I can try to figure it out.

You may try third-party tools like FastExcel (reference is within that post https://fastexcel.wordpress.com/2015/01/16/stacking-appendingthere-arraysranges-in-excel-formulas-ve...), not sure if free version exists