Is there a way to do the following in VBA?
Initialize a multidimensional array and fill it with a series of numbers,
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
Then remove some specific columns, for eg. columns 1, 2, 4. So that the end result is just the 3rd and 5th column.
Lastly how does one convert the final output to a normal one dimensional array.
Assume that you have these columns in an Excel sheeet. If you only have these data in these columns you may simple delete the columns you need 😀 Then you will end up with 2 columsn you desire. Without knowing what you really need at the end this is the best blind guess..
e.g. your columns starts at B to F:
You can use the same logic to process the array.
But what will you do with the last two columns without putting it into the sheet? Very curious. So please confirm what you need, so anyone here can help you.
EDIT as per OP’s comment:
You may take a look at this posts and articles which has manupulation of arrays in different ways:
Then in order to populate a 2D array for an example in VBA, check this out: