+ Reply to Thread
Results 1 to 5 of 5

Autohide row based on certain cell value?

  1. #1
    Registered User
    Join Date
    01-16-2009
    Location
    Hartford, CT
    MS-Off Ver
    Excel 2010
    Posts
    56

    Autohide row based on certain cell value?

    I've come close to finding the answer, but seem to keep falling short. Here's what I'm trying to accomplish:

    Column A (rows 14-35) will contain either "Y" or "N" or no response.
    If a user selects "N", I want the row to be automatically hidden.

    Autofilter doesn't "automatically" hide the row. I need to "reset" the autofilter and redefine the conditions in order for autofilter to hide the rows. I want the rows to be hidden instantly.

    Any way to accomplish this? Thanks...
    Last edited by ajava; 04-27-2011 at 02:57 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Autohide row based on certain cell value?

    Hello ajava,

    You need a Worksheet event macro to do this. Here is the macro and the instructions to install it.
    Please Login or Register  to view this content.

    How to Save a Worksheet Event Macro
    1. Copy the macro using CTRL+C keys.
    2. Open your Workbook and Right Click on the Worksheet's Name Tab for the Worksheet the macro will run on.
    3. Left Click on View Code in the pop up menu.
    4. Paste the macro code using CTRL+V
    5. Make any custom changes to the macro if needed at this time.
    6. Save the macro in your Workbook using CTRL+S
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: Autohide row based on certain cell value?

    This code assumes that the user will be using drop down validation to make choices and that no choice will be given outside of column A or outside of rows 14-35.
    Please Login or Register  to view this content.
    If your question has been satisfactorily addressed, please consider marking it solved. Click the Thread Tools dropdown and select Mark thread as solved.
    Also, you might want to add to the user's reputation by clicking the star icon in the lower left corner of the post with the answer- it's why we do what we do...

    Thomas Lafferty
    Analyst/Programmer

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Autohide row based on certain cell value?

    ajava,

    To do it automatically, you'd probably have to use VBA, specifically the Worksheet_Change event.

    Instructions (I have also included an attachment that contains these instructions with screenshots):
    1. Save a copy of the workbook you want to put the code in
      • Always test code or suggestions in a copy, not the original, just in case it does not work as intended
    2. Copy the code below
    3. Open the workbook copy and press ALT+F11 to open the Visual Basic Editor
    4. Double-click on the worksheet that contains the column being monitored
    5. Paste the code
    6. Save the copy
    7. See if it works

    Please Login or Register  to view this content.


    Notes:
    -Change ColYN to be the column letter of the column that holds the "Y" or "N" values (In the code its currently checking column A)

    Hope that helps,
    ~tigeravatar
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    01-16-2009
    Location
    Hartford, CT
    MS-Off Ver
    Excel 2010
    Posts
    56

    Re: Autohide row based on certain cell value?

    LEITH - Brilliant! I am very grateful for the thorough, accurate and quick solution! Thank you so much!

+ 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