+ Reply to Thread
Results 1 to 6 of 6

Help with VBA to hide/reveal rows subject to dop down selection

  1. #1
    Registered User
    Join Date
    11-09-2016
    Location
    UK
    MS-Off Ver
    365
    Posts
    85

    Help with VBA to hide/reveal rows subject to dop down selection

    I have an excel template which will be used as a form completed by users

    I have it set up so that certain rows are visible subject to a drop down selection

    For example - one question is "how many passengers were in the vehicle", if the user selects 1 then a block of 14 rows with questions about the passenger become visible. if they select 2 then 2 x blocks of 14 rows with questions appear, and so on.

    The bit I'm struggling with is if the user selects a number in error and wants to change it back - ie they select 2 then change it to 1 - I'm looking for the most efficient way to code this so that it "resets"

    At the moment I've added a "reset" button which basically removes the selection altogether and hides all of the rows enabling the user to start again. But I'm hoping for a better solution so that the user can "toggle" between selections. Is this possible?

    Thanks in advance!

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Help with VBA to hide/reveal rows subject to dop down selection

    What is your current code?
    Also could you please upload a sample of your workbook?

  3. #3
    Registered User
    Join Date
    11-09-2016
    Location
    UK
    MS-Off Ver
    365
    Posts
    85

    Re: Help with VBA to hide/reveal rows subject to dop down selection

    Hi Fluff13

    WARNING: I'm new to VBA so sure I've gone a long way for a shortcut with a lot of my code and it will make your brain hurt!

    Current code:

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

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Help with VBA to hide/reveal rows subject to dop down selection

    Just add this
    Please Login or Register  to view this content.
    to the very beginning of your Passengers Sub

  5. #5
    Registered User
    Join Date
    11-09-2016
    Location
    UK
    MS-Off Ver
    365
    Posts
    85

    Re: Help with VBA to hide/reveal rows subject to dop down selection

    I have no idea how or why that works but it does, perfectly! Thanks Fluff13 for saving me endless hairpulling!!

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Help with VBA to hide/reveal rows subject to dop down selection

    You're welcome & thanks for the feedback.

    It simply hides everything before rows etc get unhidden depending on the value in C65

+ 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. Show rows based on Selection and hide rest of rows
    By Sanjibghosh in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-20-2017, 10:27 AM
  2. Grouped rows, hide/reveal base on cell value
    By JonesyCC in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-21-2016, 09:14 PM
  3. Hide/Unhide a Selection of Rows
    By EngineerCora in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2013, 03:57 AM
  4. Drop down menus that hide or reveal cells
    By markugo in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-26-2013, 03:57 PM
  5. Trying to Hide a selection of rows....
    By JukeBoxHero in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-01-2012, 08:10 AM
  6. Using a listbox to hide/reveal rows.
    By graveyardshiftee in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-17-2012, 12:09 AM
  7. Hide/Reveal
    By magneticgravity in forum Excel General
    Replies: 2
    Last Post: 04-09-2008, 06:34 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