JONABRA
New Member
- Joined
- Mar 15, 2019
- Messages
- 19
Hi I have an array mulitple columns wide and I would like to take only a select few columns of that array and add it into another array for use elsewhere. I came across a piece of code that looks like this :
temparr is ideally just a few selected columns of mainarry, and mainarray is the "master" array with multiple columns of data.
I believe its called splicing, however I can't seem to get it to work, when I check the watches window I notice that only the first row is taken (or whatever row number I put in the place of "0"), I've tried all sorts of combinations of that line of code but I can't seem to get at placing entire columns into "temparr".
I've tried transpose and it does not work either:
any ideas?
thanks
VBA Code:
temparr = Application.Index(mainarray, 0, Array(1, 2, 3, 5, 6, 7))
temparr is ideally just a few selected columns of mainarry, and mainarray is the "master" array with multiple columns of data.
I believe its called splicing, however I can't seem to get it to work, when I check the watches window I notice that only the first row is taken (or whatever row number I put in the place of "0"), I've tried all sorts of combinations of that line of code but I can't seem to get at placing entire columns into "temparr".
I've tried transpose and it does not work either:
VBA Code:
temparr = Application.Index(mainarray, 0, WorksheetFunction.Transpose(Array(1, 2, 3, 5, 6, 7)))
any ideas?
thanks