+ Reply to Thread
Results 1 to 2 of 2

Hide all rows until first null row

  1. #1
    Registered User
    Join Date
    05-22-2013
    Location
    Indiana
    MS-Off Ver
    Excel 2007
    Posts
    15

    Hide all rows until first null row

    Example:
    ______A______B______C______D. . .
    1 TAB TITLE___HIDE MACRO___UNHIDEMACRO_
    2____12_____52______42_____1 . . .
    3____56_____24______45_____8 . . .
    4____64_____26______41_____2 . . .
    5_TAB TITLE_HIDE MACRO___UNHIDEMACRO_
    6____red______B______Y_____U . . .
    7____blue______R______Y_____D . . .
    8____green__Y______Y_____U . . .

    So I currently have a "Tab System" in my excel sheet. I do this because I have many many long tables so it is easier to view is I have the ability to hide and unhide tables with a click. I have a macro attached to a button in row 1 that when clicked hides all rows2-4 (above). Another macro button is next to it (still in row 1) that when clicked unhides rows 2-4. Likewise I have a macro in row 5 that when clicked hides rows 6-8 and a macro next to that (still in row 5) that unhides rows 6-8. This works great and my data is very tidy. However, I want to use this excel file as a templete (in other words I want to be able to use different data and just dump it in and everything is automatic. So here is my question. How would I write code that tells excel to check each row and as long as all cells in the row are not null then hide that row. Keep checking each row until it finds the first row that it NULL all the way across. I want it to hide no cells below that point. Does that make sense at all?

    Using example above I want to be able to dump new data in:
    ______A______B______C______D. . .
    1 TAB TITLE_______HIDE MACRO___UNHIDEMACRO_
    2____16_____52______22_____1 . . .
    3____56_____24______45_____8 . . .
    4____64_____26______41_____2 . . .
    5____34_____324_____3______4. . .
    6_TAB TITLE______HIDE MACRO___UNHIDEMACRO_
    7____red______B______Y_____U . . .
    8____blue______R______Y_____D . . .
    9____green__Y______Y_____U . . .

    I want a macro in row 1 that hides rows 2-5 and a macro next to it that unhides rows 2-5. Similiaryly a macro in row 6 that hides rows 7-9 and a macro in row six that unhides rows 7-9. Thanks in advance

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Hide all rows until first null row

    Hi Zach,
    I want a macro in row 1 that hides rows 2-5 and a macro next to it that unhides rows 2-5. Similiaryly a macro in row 6 that hides rows 7-9 and a macro in row six that unhides rows 7-9.
    Do you need different macro for each rows set ?
    I believe a single macro will be fine... can you upload a sample excel workbook ? Thanks.


    Regards,
    DILIPandey
    <click on below * if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

+ 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