+ Reply to Thread
Results 1 to 8 of 8

Hide/Unhide rows based on cell value (result of formula)

  1. #1
    Registered User
    Join Date
    01-04-2012
    Location
    mpls mn
    MS-Off Ver
    Excel 2007
    Posts
    15

    Hide/Unhide rows based on cell value (result of formula)

    I just can't figure this out, even after looking through examples. Any help is greatly appreciated.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    01-04-2012
    Location
    mpls mn
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Hide/Unhide rows based on cell value (result of formula)

    Also, looking for visual basic code for sheet.

  3. #3
    Forum Contributor wallyeye's Avatar
    Join Date
    05-06-2011
    Location
    Arizona
    MS-Off Ver
    Office 2010, 2007
    Posts
    308

    Re: Hide/Unhide rows based on cell value (result of formula)

    A bit of VBA. Go to the VBA IDE (alt-F11), and paste this code in the worksheet module you want to hide/unhide on:

    Please Login or Register  to view this content.
    You might have to go to the immediate window (ctrl-g), and enable events for this to work. Just type in:

    application.enableevents = true

    and press enter within the immediate window.

  4. #4
    Registered User
    Join Date
    01-04-2012
    Location
    mpls mn
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Hide/Unhide rows based on cell value (result of formula)

    Thank you, this helps; can anyone tell me what the additional code is so that the rows will unhide when the value is a 1? Needs to be able to "toggle" back and forth based on the value in G16, which contains a formula. Thanks again for any help.

  5. #5
    Registered User
    Join Date
    01-04-2012
    Location
    mpls mn
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Hide/Unhide rows based on cell value (result of formula)

    Quote Originally Posted by wallyeye View Post
    A bit of VBA. Go to the VBA IDE (alt-F11), and paste this code in the worksheet module you want to hide/unhide on:

    Please Login or Register  to view this content.
    You might have to go to the immediate window (ctrl-g), and enable events for this to work. Just type in:

    application.enableevents = true

    and press enter within the immediate window.

    Thank you, I think this helps; can you tell me what the additional code is so that the rows will unhide when the value is a 1 and hide again when the value is a 0? Needs to be able to "toggle" back and forth based on the value in G16, which contains a formula. Thanks again for any help.

  6. #6
    Forum Contributor wallyeye's Avatar
    Join Date
    05-06-2011
    Location
    Arizona
    MS-Off Ver
    Office 2010, 2007
    Posts
    308

    Re: Hide/Unhide rows based on cell value (result of formula)

    You will need to change the second line:

    Please Login or Register  to view this content.
    to look at the cells that the formula looks at, rather than G16. So if G16 is:

    =if(and(a1=2,b1=4),1,2)

    then the line would need to change to:

    Please Login or Register  to view this content.
    so that it checks the actual values that change, rather than a calculation.

  7. #7
    Registered User
    Join Date
    01-04-2012
    Location
    mpls mn
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Hide/Unhide rows based on cell value (result of formula)

    Last question: The unhide part? How can I get this to unhide again when value is 1? Thanks again!

  8. #8
    Forum Contributor wallyeye's Avatar
    Join Date
    05-06-2011
    Location
    Arizona
    MS-Off Ver
    Office 2010, 2007
    Posts
    308

    Re: Hide/Unhide rows based on cell value (result of formula)

    It compares the value of G16 to 0, when G16 is equal it will hide the row, when G16 is something other than 0, it should show the row.

+ 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