Hello,
I need some help creating a VBA sub that will reorient a table that has 2D arrays from a table, to rows. Essentially the result needs to have a header row (H in column A, Team ID in B, and Team Name in C.) Then, each cell in the table is a 2D array. I need the result to make a row for each pair, using the row and column headers (M in column A, Team ID in B, Field ID in C, Model ID in D, Array[1] in E, and Array[2] in F.) For each team, it needs to loop until the end of the columns (in the end I'll probably have 5+ models), and loop through all the teams (I'll probably have 80+ teams). The result can be posted to another tab, location isn't a big deal.
I've never worked with 2D arrays and I'm not sure how to lay out this in VBA. I would greatly appreciate help with this.
Thanks!
(PS, Sorry for the screenshots...I couldn't get HTMLMaker to work today...I'll have to fix it later. I posted the screenshots and text)
<tbody>
</tbody>
<tbody>
</tbody>
I need some help creating a VBA sub that will reorient a table that has 2D arrays from a table, to rows. Essentially the result needs to have a header row (H in column A, Team ID in B, and Team Name in C.) Then, each cell in the table is a 2D array. I need the result to make a row for each pair, using the row and column headers (M in column A, Team ID in B, Field ID in C, Model ID in D, Array[1] in E, and Array[2] in F.) For each team, it needs to loop until the end of the columns (in the end I'll probably have 5+ models), and loop through all the teams (I'll probably have 80+ teams). The result can be posted to another tab, location isn't a big deal.
I've never worked with 2D arrays and I'm not sure how to lay out this in VBA. I would greatly appreciate help with this.
Thanks!
(PS, Sorry for the screenshots...I couldn't get HTMLMaker to work today...I'll have to fix it later. I posted the screenshots and text)
Model1 | Model1 | Model1 | Model2 | Model2 | Model2 | ||
Rank | Account | City | Rank | Account | State | ||
T_LION | Detroit Lions | 2,W | SALES,W;MARGIN,R;INCOME,R | Detroit,W | 1,W | SALES,R;MARGIN,W;INCOME,R | Michigan,W |
T_PACKERS | Green Bay Packers | 1,W | SALES,W;MARGIN,R;INCOME,R | Green Bay,W | 2,W | SALES,R;MARGIN,W;INCOME,R | Wisconsin,W |
T_DOLPHINS | Miami Dolphins | 3,W | SALES,W;MARGIN,W;INCOME,R | Miami,W | 3,W | SALES,R;MARGIN,W;INCOME,R | Florida,W |
<tbody>
</tbody>
H | T_LION | Detoit Lions | |||
M | T_LION | Rank | Model1 | 2 | W |
M | T_LION | Account | Model1 | SALES | W |
M | T_LION | Account | Model1 | MARGIN | R |
M | T_LION | Account | Model1 | INCOME | R |
M | T_LION | City | Model1 | Detroit | W |
M | T_LION | Rank | Model2 | 1 | W |
M | T_LION | Account | Model2 | SALES | R |
M | T_LION | Account | Model2 | MARGIN | W |
M | T_LION | Account | Model2 | INCOME | R |
M | T_LION | State | Model2 | Michigan | W |
H | T_PACKERS | Green Bay Packers | |||
M | T_PACKERS | Rank | Model1 | 1 | W |
M | T_PACKERS | Account | Model1 | SALES | W |
M | T_PACKERS | Account | Model1 | MARGIN | R |
M | T_PACKERS | Account | Model1 | INCOME | R |
M | T_PACKERS | City | Model1 | Green Bay | W |
M | T_PACKERS | Rank | Model2 | 1 | W |
M | T_PACKERS | Account | Model2 | SALES | R |
M | T_PACKERS | Account | Model2 | MARGIN | W |
M | T_PACKERS | Account | Model2 | INCOME | R |
M | T_PACKERS | State | Model2 | Wisconsin | W |
H | T_DOLPHINS | Miami Dolphins | |||
M | T_DOLPHINS | Rank | Model1 | 3 | W |
M | T_DOLPHINS | Account | Model1 | SALES | W |
M | T_DOLPHINS | Account | Model1 | MARGIN | W |
M | T_DOLPHINS | Account | Model1 | INCOME | R |
M | T_DOLPHINS | City | Model1 | Miami | W |
M | T_DOLPHINS | Rank | Model2 | 3 | W |
M | T_DOLPHINS | Account | Model2 | SALES | R |
M | T_DOLPHINS | Account | Model2 | MARGIN | W |
M | T_DOLPHINS | Account | Model2 | INCOME | R |
M | T_DOLPHINS | State | Model2 | Florida | W |
<tbody>
</tbody>
Last edited: