Consulting

Results 1 to 4 of 4

Thread: VBA Code to Automate Grouping

  1. #1

    VBA Code to Automate Grouping

    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.

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Can you post a sample workbook and a desired result?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    I actually pulled out some old code and modified it to do the trick. Thanks regardless.

  4. #4
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Can you post your solution for the benefit of others?
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •