PDA

View Full Version : VBA Code to Automate Grouping



pliskers
06-02-2009, 10:05 AM
I have a report with various rows of detail which are grouped in 4 different levels, as indicated by the grouping number buttons at the top left corner of the worksheet.

Would there be any code to scroll down one or more columns (as needed) and, based on a number in each row within that column, go through the cycle of grouping the rows?

For example, if 4 indicates the lowest level of grouping, the code would find the first occurrence of a "4", and then group all the rows until something other than a "4" is encountered. After going through all the rows of the report, it would begin back at the top and repeat the procedure looking for "3"s, and so on.

Hope this is clear. Please follow up with any questions if not. Many thanks.

mdmackillop
06-02-2009, 11:19 AM
Can you post a sample workbook and a desired result?

pliskers
06-02-2009, 02:13 PM
I actually pulled out some old code and modified it to do the trick. Thanks regardless.

mdmackillop
06-02-2009, 02:15 PM
Can you post your solution for the benefit of others?