+ Reply to Thread
Results 1 to 6 of 6

Loop to group data

  1. #1
    Forum Contributor
    Join Date
    09-13-2008
    Location
    Los Angeles, CA
    MS-Off Ver
    365
    Posts
    120

    Loop to group data

    I think I need a macro that is a for while loop that will group data for me...

    I basically have a number of reports that go like this:
    Blank line
    data 1
    data 2
    data 3
    data 4
    BOLD data
    Blank line
    data 5
    data 6
    data 7
    data 8
    BOLD data
    ...etc

    I basically would like to create a macro that groups all data and only leaves the 'BOLD data' visible when I collapse that grouping... so I would only see:
    Blank line
    ------------
    BOLD data

    With the "---" signifying the hidden (grouped) data lines. I feel like this is fairly easy to create, just not sure where to start.

    The pattern is consistent throughout the documents with only needing to look at column A for the bold/blank criteria, and it can stop as soon as it finds 2 consecutive blank lines.


    Thanks in advance for any help!

  2. #2
    Forum Contributor
    Join Date
    09-13-2008
    Location
    Los Angeles, CA
    MS-Off Ver
    365
    Posts
    120

    Re: Loop to group data

    No responses? I figured this would be easy... guess not

  3. #3
    Registered User
    Join Date
    05-30-2012
    Location
    St Paul, MN
    MS-Off Ver
    2010
    Posts
    51

    Re: Loop to group data

    Hi,
    Try this
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Loop to group data

    hi koticphreak, option based on your example, run code "test"
    Attached Files Attached Files
    Last edited by watersev; 10-18-2012 at 03:43 AM.

  5. #5
    Registered User
    Join Date
    05-30-2012
    Location
    St Paul, MN
    MS-Off Ver
    2010
    Posts
    51

    Re: Loop to group data

    watersev,
    That's a nifty way of doing it.

  6. #6
    Forum Contributor
    Join Date
    09-13-2008
    Location
    Los Angeles, CA
    MS-Off Ver
    365
    Posts
    120

    Re: Loop to group data

    Hate to bring a post from the dead, but watersev's post was a huge help and totally worked. However, now the data has gotten more complicated, and there is sometimes now a blank row right before the bold - so now I need something that will always group based on the bold, not the blank row. Other than that, all else is the same! Thanks in advance.

    Also I will add (based on cjo's post) that the blank row is never set to bold, so no worry there.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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