Q: Creating a macro to sort and group columns in a sheet according to another sheet
Hello group.
I have predefined a sheet that has a lot of grouping of columns like
this:
|"A"|"B"|group_1_name|"D"|"E"|"F"|group_2_name|"G" |"H"|"I"|group_3_name|
Group 1 has the columns with the elements "A" & "B"
Group 2 has the columns with the elements "D","E" & "F".
Group 3 has the columns with the elements "G","H" & "I"
This means that if the groups are closed the sheet will look like this:
|group_1_name|group_2_name|groups_3_name|
Now i have a sheet with the top column elements like this:
|"B"|"I"|"D"|"F"|"G"|
then I what my macro to sort and group the columns to the following
result:
|"B"|group_1_name|"D"|"F"|group_2_name|"G"|"I"|gro up_3_name|
Where Group 1 has element "B" , Group 2 has elements "D" & "F" and
Group 3 has elements "G" and "I".
My guess is that key steps in the macro could be:
Step 1: Sort columns like predefined sheet
Step 2: Group columns like predefined sheet
Step 3: Insert group_?_name column
Does anyone have some hints on how I'll get started on this problem?
Any help is greatly appreciated. Let me know if my question is unclear.
Regards,
Mb
|