Hello,
I have a situation where I need to group rows of a table that has been copied from a Pivot Table. There are so many rows that doing this manually takes considerable time so any help that can be provided is much appreciated.
The table is structured much like a Pivot Table in that it has subtotals at each section of the hierarchy. The attached file demonstrates the basic structure of what I am dealing with. In column A, I have the first column of the hierarchy which is subtotaled. Column B is the second column of the hierarchy and column C would be the values. For all the categories in the hierarchy, there will be a variable number of categories (ie in the file I have only one Primary Value listed under Primary Value, but I could have many more). Same applies to the Secondary Value of the hierarchy.
I was thinking that after I get the counts of the number of unique values in the Primary Value and Secondary Value, I could set a do until = Primary Value Count/Secondary Value Count loop to set the groupings, but I am failing to understand how to code the groupings so the sub would know that A2:A12 (for example in the attached workbook) is a grouping. Further, I dont understand how once that first grouping is made, to tell the macro to step down to A13:Ax to make the next grouping and so on.
Thank you again for any guidance.
learning_vba
Bookmarks