+ Reply to Thread
Results 1 to 1 of 1

Nesting Named Ranges and Hiding/Revealing Rows based on User Input/Drop-Downs

  1. #1
    Registered User
    Join Date
    10-25-2023
    Location
    Philadelphia, PA, USA
    MS-Off Ver
    MS Office Home and Student 2016
    Posts
    2

    Nesting Named Ranges and Hiding/Revealing Rows based on User Input/Drop-Downs

    Hello! I am relatively new to VBA and Excel, so please pardon if my code/knowledge is lacking.

    I have a worksheet that deals with locations and facilities. The user can choose up to 10 locations via a dropdown cell menu in cell D4. This uses data validation, just a list, with values 1-10 as options. I have the corresponding sections in named ranges location1, location2, etc. Depending on how many locations the user selects in D4, the corresponding named ranges are revealed. The rows they're in are hidden by default.

    Within these named ranges, there is another dropdown cell, where the user can select up to 5 facilities that will be visited at each location. This dropdown cell is similar to D4 in that it's just a data validation list with options 1-5. This also refers to named ranges, facility1.1 through facility1.5. Depending on how many facilities the user selects in the dropdown cell, the macro hides/reveals the associated rows.

    My problem is, if the user selects more than one location, that is, if they change their input in D4 to 2 rather than 1, it will reveal all hidden rows pertaining to facilities, including the ones that the facilities macro is trying to hide. I'm basically trying to nest these named ranges and drop-down cells and not having luck.

    I need to somehow have it check and see if rows are hidden before revealing them and the next named range.

    I currently have the two macros in separate modules (1 and 3). In my code, I refer to cell K16 as the drop-down cell for choosing how many facilities per location. Obviously, there are many more drop-down cells than just K16 (although all are in column K), but I was just trying to get one instance to work before delving into the rest.

    Please check out my attached spreadsheet. For quick reference, here is my code for Module 1 which deals with the Facilities:

    Please Login or Register  to view this content.

    Here is my code for Module 3 which deals with Locations:

    Please Login or Register  to view this content.




    Any help is appreciated. I'm not the best at explaining things, so it may be easiest to checkout the attachment and just see the issue when you select 2 locations instead of one. You'll see how it then reveals all of the facility rows despite only one facility being selected. Thanks!
    Attached Files Attached Files
    Last edited by roccasar; 10-25-2023 at 03:30 PM.

+ 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] Hiding/Unhiding Rows based on Multiple Drop Downs
    By ncsps in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-13-2019, 05:24 AM
  2. [SOLVED] Show/hide rows based on drop down cell using named ranges
    By Stu091074 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-07-2014, 11:00 AM
  3. Hiding rows based on a user input box
    By jshaw82 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-08-2013, 06:34 PM
  4. Hiding Rows A & B- drop downs in other areas disappear
    By Dmaxin in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-30-2013, 04:52 PM
  5. Replies: 1
    Last Post: 02-09-2013, 08:42 AM
  6. [SOLVED] Hiding / Revealing rows based on Cell Value
    By Sky188 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-01-2012, 03:41 PM
  7. Hiding/Revealing Rows based on a cell value
    By Sky188 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-06-2012, 05:41 PM

Tags for this Thread

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