+ Reply to Thread
Results 1 to 7 of 7

Macro to Group Rows Along a Range Based on Values in a Column

  1. #1
    Registered User
    Join Date
    12-11-2008
    Location
    Southern California
    Posts
    13

    Macro to Group Rows Along a Range Based on Values in a Column

    I need a macro to group rows based on values in a specific column.

    I have a dashboard with data from row 21 to row 5000. The cells in column GM have the following values: "Hide", "Not Hide", or are blank. The data is sorted based on values in columns A, B, and C. As a result, there is no inherent order to the "Hide" or "Not Hide" values in the cells in column GM.

    I need a macro to go down column GM, and group any row where the value in column GM is "Hide". In some cases, only a single row will be grouped with a "+" sign. In other cases, consecutive rows will be grouped as such.

    I want to go with grouping rather than filtering because with grouping, data hidden along the range of the dashboard is more readily accessible.

    Any help would be greatly appreciated.

    Thank you very much.
    Last edited by JHCali; 05-23-2010 at 08:25 PM.

  2. #2
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Macro to Group Rows Along a Range Based on Values in a Column

    JHCali;

    I'm curious; what do you mean by "Group"?
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

  3. #3
    Registered User
    Join Date
    12-11-2008
    Location
    Southern California
    Posts
    13

    Re: Macro to Group Rows Along a Range Based on Values in a Column

    Quote Originally Posted by foxguy View Post
    JHCali;

    I'm curious; what do you mean by "Group"?
    Hi Foxguy,

    I am using Excel 2007. By group, I want the macro the accomplish what I would otherwise have to do by manually selecting individual or consecutive rows with a value of "Hide" in column GM, and going to the Data tab, selecting Group, then Group again. The Group feature in Excel ties a range of cells together so they can be expanded or collapsed.

  4. #4
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: Macro to Group Rows Along a Range Based on Values in a Column

    JHCali;

    I'm constantly learning things about Excel.
    Try This
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-11-2008
    Location
    Southern California
    Posts
    13

    Re: Macro to Group Rows Along a Range Based on Values in a Column

    Foxguy,

    Worked brilliantly! Thank you so much!

  6. #6
    Registered User
    Join Date
    06-01-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Macro to Group Rows Along a Range Based on Values in a Column

    Foxguy,
    i was trying to write a macro similar to above, but my requirement was that macro should group all the rows containing data below a blank cell. In the example, i wanted the macro to group rows 3, 4 & 6,7 & so on. Can you please guide me?
    Group & Outline.JPG
    Last edited by ashutoshsingbal; 08-26-2013 at 11:40 PM.

  7. #7
    Registered User
    Join Date
    09-06-2013
    Location
    miami, USA
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Macro to Group Rows Along a Range Based on Values in a Column

    Hey Foxguy, I need some help.

    I ran your code but it stopped after the group command.
    In other words, once the code grouped the first set of rows marked with hide it stopped running.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1