+ Reply to Thread
Results 1 to 5 of 5

Macro to hide range of 13 rows if sutotal of range for row 1-13=0 (includes 2 blank rows)

  1. #1
    Registered User
    Join Date
    09-18-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    3

    Question Macro to hide range of 13 rows if sutotal of range for row 1-13=0 (includes 2 blank rows)

    I have been looking for hours for a macro for this and all I find are macros to hide one row at a time. I have a list of 50 unique items with data in columns C thru AI. For each of those in my spreadsheet, the rows are as follows: Row1 is a blank line separating it from the item above. Row 2 is the item number. Rows 3-12 contain data. Row 13 is the subotal for columns S-AI. I need a macro that can look at the subtotal in column AI, the 13th row for each item and if it =0, then hide lines 1-13 for that item. Can this be done?

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: Macro to hide range of 13 rows if sutotal of range for row 1-13=0 (includes 2 blank ro

    Try something like this. Assumes the first item's subtotal line is at the actual row 13.

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 09-23-2013 at 01:12 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Macro to hide range of 13 rows if sutotal of range for row 1-13=0 (includes 2 blank ro

    Hi
    Cut and paste this macro into a module in your workbook then run it on your data to test.
    This macro is based on the fact that there will be one blank row below each of your subtotals.

    Please Login or Register  to view this content.
    Hope this helps.
    Good luck.
    Tony

  4. #4
    Registered User
    Join Date
    09-18-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Macro to hide range of 13 rows if sutotal of range for row 1-13=0 (includes 2 blank ro

    Thank you AlphaFrog, but I tried the macro and it hid ALL of my rows, even the ones that were not zero.

    ARGK (Tony)...The macro works perfectly! You have no idea how you've made my day! Thank you so much!

    I appreciate both of your very fast replies!

  5. #5
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Macro to hide range of 13 rows if sutotal of range for row 1-13=0 (includes 2 blank ro

    Thanks for the feedback.
    Tony

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Hide all rows where a range of cells are blank
    By a45ward in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-02-2010, 06:29 AM
  2. Hide blank rows within a range
    By bangelta in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-04-2008, 06:41 AM
  3. Resolved >>> Hide blank rows within a range
    By jeff.p in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-27-2007, 03:00 AM
  4. Resolved >>> Hide Blank rows within a range:
    By jeff.p in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-23-2007, 11:26 PM
  5. Hide blank rows in a range
    By trussman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-18-2005, 12:06 PM

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