+ Reply to Thread
Results 1 to 12 of 12

Hide/Unhide rows based on Yes or No answers to questions by dropdown list.

  1. #1
    Registered User
    Join Date
    02-03-2009
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    30

    Hide/Unhide rows based on Yes or No answers to questions by dropdown list.

    Hello All

    I have a basic questionnaire with 10 questions in it. Under each questions there are some rows to use depending on the answer. Please see attached sample workbook.
    Each question has to be answered by a drop-down list of Yes or No.

    For example:

    If the answer is "No" to Question 1, rows 4 to 11 remain hidden or re-hidden.
    If the answer is "Yes" then rows 4 to 11 are revealed to give further details.

    Next

    Question 2 and if the answer is "No", row 14 to 21 remain hidden ...... and so on

    Any help is appreciated.

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Hide/Unhide rows based on Yes or No answers to questions by dropdown list.

    Right Click on the sheet name at the bottom of excel and select view code.

    paste this macro there.

    Please Login or Register  to view this content.
    This will make the worksheet work as you describe.

    I think that these two macros are also needed, so I put them in a normal macro module for you:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Hide/Unhide rows based on Yes or No answers to questions by dropdown list.

    I also wrote a routine for you:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  4. #4
    Registered User
    Join Date
    02-03-2009
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Hide/Unhide rows based on Yes or No answers to questions by dropdown list.

    Mehmetcik

    Thank you very much for your help. It works perfect as it is!

    If I change the questionnaire with a mixture of different questions and do not keep the same pattern of distance and space for answers;
    Can I specifically name the target range and rows to hide in the code?

    For example after the question1, question 2 will have only two rows for the answer, question3 will have 3 rows and question 4 only one.

    Once again thanks for your help (Teşekkür ederim=

  5. #5
    Registered User
    Join Date
    02-03-2009
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Hide/Unhide rows based on Yes or No answers to questions by dropdown list.

    Xladept

    Thank you for your help too.

    I just saw your reply now.

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Hide/Unhide rows based on Yes or No answers to questions by dropdown list.

    Hi Johny,

    My routine depends upon the file being situated as presented - if you start changing the gaps between tables, it will be useless

  7. #7
    Registered User
    Join Date
    02-03-2009
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Hide/Unhide rows based on Yes or No answers to questions by dropdown list.

    Xladept

    Yes I understand.

    Is there a way to name the target cells and then based on the cell value (Yes or No) a specified range of rows are hidden?

    For example;

    If "K12" is "No", then rows(14:20) hidden, if "Yes" visiable.
    next
    if "K22" is "No", then row(24:26) hidden (shorter range to hide here) and so on.

    Thank you

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Hide/Unhide rows based on Yes or No answers to questions by dropdown list.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    02-03-2009
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Hide/Unhide rows based on Yes or No answers to questions by dropdown list.

    Xladept

    Working well.

    Thank you

  10. #10
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Hide/Unhide rows based on Yes or No answers to questions by dropdown list.

    You're welcome!

  11. #11
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Hide/Unhide rows based on Yes or No answers to questions by dropdown list.

    Phew

    It took me forever to get the find working.

    This version will work for various question lengths:

    Please Login or Register  to view this content.
    And the two extra macros:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    02-03-2009
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: Hide/Unhide rows based on Yes or No answers to questions by dropdown list.

    Mehmetcik

    Excellent work, thank you very much for your time and effort.

    Regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. hide/unhide columns based on dropdown list.
    By bg781np in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-18-2013, 07:13 PM
  2. Automatically Hide/Unhide Columns Based Dropdown List
    By Kapil.gour in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-27-2012, 07:39 AM
  3. Macro to hide and unhide sheets based on Yes / No answers
    By c.williambaker in forum Excel General
    Replies: 2
    Last Post: 06-15-2012, 09:02 AM
  4. Refine a list of data based upon answers to dropdown questions in excel
    By sk8blitz23 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-17-2012, 12:51 PM
  5. Hide/Unhide rows Based on Value from Dropdown Lists
    By 2Deep in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2010, 09:43 PM

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