+ Reply to Thread
Results 1 to 4 of 4

Hide/unhide rows based on form input

  1. #1
    Registered User
    Join Date
    03-02-2013
    Location
    Drunen, Netherlands
    MS-Off Ver
    Excel 2007, 2010
    Posts
    23

    Hide/unhide rows based on form input

    Dear reader,

    Since recently i am working on a excel sheet in which i want to hide and unhide specific rows based on the input of a form.

    At the moment i have created a button and i attached a form to it in VBA. The form has multiple inputs (around 9). The user can either select one option or more. Each option is linked to a row which will either be hidden (if the option is unselected) or visible (if the option is selected).

    The code i have created is the following:

    Please Login or Register  to view this content.
    These rows will be hidden on startup of the excel sheet:
    Please Login or Register  to view this content.
    The problem i am countering is the following: when the button is clicked, a set of information (depending on the form input) will be showed. Though for all the 9 options there are 3 rows which are general for all those options. These 3 general rows will be hidden when i click a specific option (because it will only show the options data row, 1 row, and not the general rows) The question is: how can i make my code in such way that when i choose an option, that specific option data will be showed but the general tabs will be showed aswell. And when i click CLEAR on my form (so no options selected) all of my rows will dissapear BUT ALSO the general rows..

    I hope i made it clear enough; if i havent here some images to make it a bit clearer:

    On load all the rows are hidden (15 till 26):
    img 1.png

    When i choose an option, the sepecific data will show:
    img 2.png

    Though what i want to happen is that when i choose an option the GENERAL rows will show aswell, like so:
    img 3.png

    The problem however is that when i put in the row range 15:26 (hide and unhide) at each IF statement, the IF statements will override eachotter.. And when i clear all, so none of the options is slected, the general row has to hide aswell..

    I hope i made my problem a bit clear and sorry for repeating and overexplaining my problem / question (i tend to do that a lot )

    Thanks in advance!

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Hide/unhide rows based on form input

    Put the rows(15:26) hide and unhide at the start and then put the individual if statements after each other? Also, you can replace:
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-02-2013
    Location
    Drunen, Netherlands
    MS-Off Ver
    Excel 2007, 2010
    Posts
    23

    Re: Hide/unhide rows based on form input

    Thank you for your fast reply! But it isnt quite clear yet for me.
    This might sound stupid since i am quite new to this, but if i add the hide/unhide at the start (15:26) wont that cause all the options to be showed, even the ones i didnt select? Wont the show / hide of the general rows ( row 15, 16 and 26) require a separte IF statement like: when a selection is made (1 or more options are selected) the general rows SHOW and when NONE of the options are selected the general rows WONT SHOW?

    Another stupid question: How can i put a specific row selection, for example what i got now is (15:26) this will show all the rows from 15 up to 26, but what i want is that it shows ONLY the rows 15, 16 and 26..

    Once again, thanks

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Hide/unhide rows based on form input

    Maybe try something like:
    Please Login or Register  to view this content.
    althought it assumes that the rows in question contain some data and are not just blank.

+ 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. [SOLVED] Hide/Unhide Rows based on Combo Box (form control)
    By JimExcel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-01-2013, 09:38 AM
  2. Auto hide/unhide based on input
    By UnSpoknOne in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-03-2011, 06:11 PM
  3. unhide/hide rows based on value input
    By whoosh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-01-2009, 11:25 PM
  4. hide/unhide rows depending on the top input value
    By TiDz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-07-2006, 05:55 AM
  5. [SOLVED] hide/unhide rows depending on the top input value
    By TiDz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-07-2006, 04:05 AM

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