+ Reply to Thread
Results 1 to 5 of 5

Automatically Hiding rows based on checkboxes

  1. #1
    Registered User
    Join Date
    09-19-2012
    Location
    Philadelphia, US
    MS-Off Ver
    Excel 2010
    Posts
    9

    Automatically Hiding rows based on checkboxes

    Hi all!

    I'm trying to figure out a way to automatically hide a number of rows based on a checkbox. Basically I want to hide rows 27:37 if a checkbox is NOT checked, and show the same rows if the checkbox is checked. I currently have the rows grouped, however I need to really tighten this workbook up and the grouping doesn't allow the clean look that I'm hoping to achieve.

    Attached is a sample of what I am trying to accomplish. I would like to be able to hide rows 27:37 if the checkbox for "Land Tracts" IS NOT checked, as well as show rows 27:37 if the checkbox IS selected.

    I really appreciate any help the community could offer.

    Jake
    Attached Files Attached Files
    Last edited by Jake Bierly; 09-19-2012 at 06:07 PM. Reason: Solved

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

    Re: Automatically Hiding rows based on checkboxes

    hi Jake Bierly, welcome to Excelforum, please check attachment
    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Automatically Hiding rows based on checkboxes

    Hi Jake,
    I edited your sheet to have the checkbox hide/unhide the rows. See attachment.

    This what I've done:
    Firstly you have to link the checkbox to a cell (I've choosen the cell rigth above the checkbox just to illustrate, but it can be anay cell on any sheet).
    Secondly you will have to link the checkbox to a macro: move your mouse over the checkbox and right-click. Select Assign macro and in the next window Edit.
    You will see the macro-editor with the simple code which reads the content of the linked cell (B8) and hides the rows if B8 is false, resp. shows the rows when B8 is true. I think you can copy this yourself for any other checkboxes if necessary.
    You can also find the macro when you select Macros in the Extra-menu. Or you can select the Visual Basic Editor and open the Module there.

    By the way, don't mind the (maybe) weird name of the macro. That's because I'm using a Dutch version of Excel.
    Attached Files Attached Files
    Cheers!
    Tsjallie




    --------
    If your problem is solved, pls mark the thread SOLVED (see Thread Tools in the menu above). Thank you!

    If you think design is an expensive waste of time, try doing without ...

  4. #4
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Automatically Hiding rows based on checkboxes

    Nice and simple piece of code by watersev, though.

  5. #5
    Registered User
    Join Date
    09-19-2012
    Location
    Philadelphia, US
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Automatically Hiding rows based on checkboxes

    Thanks Tsjallie! Works flawlessly!

+ 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