Hello,
I'm trying to write a macro that modifies the layout of my report, but I'm at a loss for figuring out the algorithmn . I would really appreciate some help. (sorry for the long description, see example below for a visual)
In column A there are headers, in column B there are sub-headers, in column C there are questions and in column D there are answers. The current layout has headers/sub-headers/questions/answers in every row. I've sorted the data by headers (column A) then by sub-headers (col B).
I'd like the report to have the following layout: Each unique header to have it's own row (merged across columns A to D), the row below that to have the sub-header merged (columns A to D) and the row(s) below that to have the question(s) in column A and the answer(s) adjacent to it in column B.
For each header there are 2-5 sub-headers and for each sub-header there are a variable amount of questions and answers.
Example - sample of current report (H - header, SH - subheader, Q - question, A - answer):
row1 - H1 (colA), SH1(colB), Q1 (colC), A1 (colD)
row2 - H1, SH1, Q2, A2
row3 - H1, SH2, Q3, A3
row4 - H2, SH3, Q4, A4
Preferred layout:
row1 - H1 (colA to colD)
row2 - SH1 (colA to colD)
row3 - Q1 (colA), A1 (colB)
row4 - Q2 (colA), A2 (colB)
row5 - SH2 (colA to colD)
row6 - Q3 (colA), A3 (colB)
row7 - H2 (colA to colD)
row8 - SH3 (colA to colD)
row9 - Q4 (colA), A4 (colB)
I'm trying to write a macro that modifies the layout of my report, but I'm at a loss for figuring out the algorithmn . I would really appreciate some help. (sorry for the long description, see example below for a visual)
In column A there are headers, in column B there are sub-headers, in column C there are questions and in column D there are answers. The current layout has headers/sub-headers/questions/answers in every row. I've sorted the data by headers (column A) then by sub-headers (col B).
I'd like the report to have the following layout: Each unique header to have it's own row (merged across columns A to D), the row below that to have the sub-header merged (columns A to D) and the row(s) below that to have the question(s) in column A and the answer(s) adjacent to it in column B.
For each header there are 2-5 sub-headers and for each sub-header there are a variable amount of questions and answers.
Example - sample of current report (H - header, SH - subheader, Q - question, A - answer):
row1 - H1 (colA), SH1(colB), Q1 (colC), A1 (colD)
row2 - H1, SH1, Q2, A2
row3 - H1, SH2, Q3, A3
row4 - H2, SH3, Q4, A4
Preferred layout:
row1 - H1 (colA to colD)
row2 - SH1 (colA to colD)
row3 - Q1 (colA), A1 (colB)
row4 - Q2 (colA), A2 (colB)
row5 - SH2 (colA to colD)
row6 - Q3 (colA), A3 (colB)
row7 - H2 (colA to colD)
row8 - SH3 (colA to colD)
row9 - Q4 (colA), A4 (colB)