Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2007
    Posts
    123
    Thanks
    13
    Thanked 1 Time in 1 Post

    Conditional row grouping possible? (2003)

    I need a macro which does what I'd call "conditional row grouping".

    I have a table, in columns D & E of annual data with the years running down the side, and in the last row is a total column

    Sometimes there will be as many as 20 years worth of data; sometimes less.

    In the attached example I've written a very basic formula which returns "Show row" in column A when I want a row to be shown, and "Hide row" when I want a row to be hidden -- the latter will apply when there's no data to show.

    How can I write a simple macro which hides the rows which say "Hide row"?

    Note: I'd strongly prefer to hide the rows using the Data / Group command, rather than by using the Format / hide rows" command -- though I guess beggars can't be choosers....

    I'd be grateful for any advice.
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Conditional row grouping possible? (2003)

    You can do this without a macro.
    Click in any cell in the table, for example in D6.
    Select Data | Filter | AutoFilter...
    Click the dropdown arrow in the Data cell (E6).
    Select (NonBlanks) from the dropdown list (it's the last item).
    That's it!

  3. #3
    2 Star Lounger
    Join Date
    Jan 2007
    Posts
    123
    Thanks
    13
    Thanked 1 Time in 1 Post

    Re: Conditional row grouping possible? (2003)

    Thanks Hans. I need to automate it but had not thought to write a macro using the autofilter. Your response quickly led me to the ultimate solution. Thanks again...

Posting Permissions

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