Hi folks,
I am having trouble figuring out how to copy two separate columns from one array into a separate temporary array. I can't assign just those two columns earlier in the process unfortunately so am trying to figure it out this way.
origArray data example:
I would like to pass only the entire columns 1 (dates) and 6 (adjusted close) to a temporary array (varTemp)
I know how to do single rows using INDEX with the following snippet, but I don't know how to do entire columns and more than one. Right now I just bring it all in and then run a macro to copy columns 1 and 6, but I was hoping to find a cleaner way.
I am having trouble figuring out how to copy two separate columns from one array into a separate temporary array. I can't assign just those two columns earlier in the process unfortunately so am trying to figure it out this way.
origArray data example:
5/3/2021 | 125.37 | 125.57 | 124.28 | 124.5 | 124.5 | 619300 |
5/4/2021 | 123.99 | 124.03 | 121.67 | 123.51 | 123.51 | 812500 |
5/5/2021 | 123.96 | 124.51 | 122.44 | 122.61 | 122.61 | 996900 |
5/6/2021 | 123.05 | 123.05 | 120.73 | 122.54 | 122.54 | 676400 |
5/7/2021 | 122.79 | 125.07 | 122.49 | 124.56 | 124.56 | 845300 |
5/10/2021 | 123.98 | 125.23 | 121.66 | 123.11 | 123.11 | 726500 |
5/11/2021 | 123.26 | 123.6 | 120.61 | 121.04 | 121.04 | 851400 |
5/12/2021 | 118.83 | 120.13 | 117.6 | 118.1 | 118.1 | 1187700 |
5/13/2021 | 119.28 | 121.11 | 119 | 120.49 | 120.49 | 916500 |
I would like to pass only the entire columns 1 (dates) and 6 (adjusted close) to a temporary array (varTemp)
I know how to do single rows using INDEX with the following snippet, but I don't know how to do entire columns and more than one. Right now I just bring it all in and then run a macro to copy columns 1 and 6, but I was hoping to find a cleaner way.
VBA Code:
'Print Row 3 to see it
varTemp = Application.WorksheetFunction.Index(origArray, 3, 0)
Debug.Print Join(varTemp, ",")