+ Reply to Thread
Results 1 to 5 of 5

When cell is modified Hide Entire Rows in a Range

  1. #1
    Forum Contributor
    Join Date
    02-16-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    108

    When cell is modified Hide Entire Rows in a Range

    Hi -

    Here's the situation...
    When Cell D12 is modified I want to hide the EntireRow in Range C12:C36 with a value equal to NA and to show EntireRow with values that is not equal to NA. I know this is possible but I don't know how. Please help me...

    Thank you

  2. #2
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: When cell is modified Hide Entire Rows in a Range

    Place this into the worksheet where you want the rows to hide - just with your design you say cell D12 is modified - with potentially hiding the range C12:C36 entire row then the cell you are using to discriminate which rows are hidden or not could potentially get hidden if the value in C12 is NA - just a design consideration - if row 12 gets hidden how do you then modify the value in D12? It would be ok if the value in D12 is dependant on some cell that will not end up being hidden by the code. You would execute this with a worksheet change event
    Please Login or Register  to view this content.
    Hope this helps.
    Anthony
    Pack my box with five dozen liquor jugs
    PS: Remember to mark your questions as Solved once you are satisfied. Please rate the answer(s) by selecting the Star in the lower left next to the Triangle. It is appreciated?

  3. #3
    Forum Contributor
    Join Date
    02-16-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    108

    Re: When cell is modified Hide Entire Rows in a Range

    Hi - I made a mistake on my statement above instead of D12 it should be D7...Thank you "smuzoen" for your help. I was able to write a code but I just don't know how to make it work through the WorksheetChangeEvent. Can someone help me make this work that when I change the D7 the below code should fire up, by the way D7 contains a dropdown from a validation.
    Please Login or Register  to view this content.
    Hudas

  4. #4
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: When cell is modified Hide Entire Rows in a Range

    This is what you need to do
    Open the workbook and Hit ALT F11 - this will open the VB editor
    Select the worksheet that contains the drop down validation list by double clicking the worksheet in the editor and copy and paste the code below into the editor
    Please Login or Register  to view this content.
    Then from the VB Editor menu at the top select Insert, then select Module. Copy your code into a module (making sure the Sub is called test as that is what the worksheet change event is calling i.e. it is calling the macro called test)
    Close the editor and then try changing the value in D7 and your code should run if you have followed my instructions above.
    Just looking at your code above you have not declared WS1 - I assume it is a worksheet - you should ensure that the variable is declared and initialised
    Please Login or Register  to view this content.
    You may have just posted a trimmed down version of your code however it is good practice to declare all variables

  5. #5
    Forum Contributor
    Join Date
    02-16-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    108

    Re: When cell is modified Hide Entire Rows in a Range

    I got it...Thank you very much for your help...

+ 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