+ Reply to Thread
Results 1 to 2 of 2

Dependent drop down list using dynamic named ranges

  1. #1
    Registered User
    Join Date
    01-18-2023
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    1

    Dependent drop down list using dynamic named ranges

    Hi there,


    I am trying to create a dependent drop down list using dynamic named ranges.


    I found a thread which explains that the INDIRECT function does not work well with dynamic named ranges, and suggests using the below VBA as a workaround.


    Option Explicit
    Function RetrieveRangeForName(psRange As String) As String
    RetrieveRangeForName = Range(psRange).Address
    End Function


    This seems very close to solving the issue. Using the VBA, I can get the dynamic named range to populate in the Excel sheet itself using the below:

    =INDIRECT(RetrieveRangeForName(A2))

    -- Cell A2 contains the dropdown list of dynamic named ranges --


    But when I copy the above formula into the Data Validation source box, it comes up with a warning saying "A named range you specified cannot be found".


    Any ideas what's going wrong?


    Cheers
    Tom

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: Dependent drop down list using dynamic named ranges

    see if the attached approach fits your needs - there are no on-sheet formula - there is no data validation or conditional formatting - the whole process is driven by a Worksheet_SelectionChange event in the Sheet1 code module.
    Utilising two 'structured tables' the process is self maintaining (add/delete without needing to expand formula) - place a number in 'F2' then move across cell by cell - to repeat and expand second table just place number in 'F3', etc., etc,.
    Attached Files Attached Files
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

+ 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. Replies: 4
    Last Post: 01-04-2023, 07:33 PM
  2. Dependent drop down list without named ranges
    By kellyb2103 in forum Excel General
    Replies: 4
    Last Post: 04-05-2022, 01:08 PM
  3. [SOLVED] Dependent Drop-down with Dynamic Named Ranges
    By LKERN in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-20-2020, 12:42 PM
  4. SUMIF (OR SUMIFS) Using data from named ranges in dynamic drop down list
    By jvcalandra in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-18-2020, 12:54 AM
  5. Dependent List Validation from Dynamic Named Ranges
    By freeride in forum Excel General
    Replies: 11
    Last Post: 01-22-2020, 03:07 PM
  6. [SOLVED] Drop down list using combo box and dynamic named ranges
    By Pauly K in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-21-2017, 06:11 AM
  7. [SOLVED] Trying to make multiple dependent drop down list with dynamic ranges
    By Gwen@YouWantWhat? in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-01-2012, 12:55 AM

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