Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7954387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:24:52+00:00 2026-06-04T03:24:52+00:00

I’m working with 7 dynamic dependent lists, and I thought the best way to

  • 0

I’m working with 7 dynamic dependent lists, and I thought the best way to automate the process and avoid to arrange anything in a future if I modify the lists was a VBA code.

The VBA code that I started to work on it is posted on: Dynamic Depending Lists in Separated WorkSheets in VBA

That code is just for the 2 first lists.

That’s the main table that I have. I want pick lists for the first row only for the yellow columns:

enter image description here

That’s the table that I have the lists (they must be dynamic):

enter image description here

The relations between my lists are:

  • Responsible list and Site list are related with Project list.
  • The other lists are related with the site list.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:24:54+00:00Added an answer on June 4, 2026 at 3:24 am

    Okay. I’ve got what you are looking for. I solved this issue a few months back in another project. Basically, indirect is no good here because it doesn’t work on dynamic named ranges, because they don’t produce an actual result, just a formula reference.

    First, set up your named ranges on a sheet like so. It’s very important that the named ranges be named in the manner I described, as this will feed the code into making your dynamic lists. Also, note, I only wrote out SamplePoints for X1 and T2. If you select other options, the code won’t work until you add those named ranges in.

    Dnyamic Named Ranges

    Then assuming input sheet is set up like below:

    Input Sheet

    Place this code in the worksheet change event of your input sheet. What it does is take the value selected in one cell and then appends the appropriate column name to feed that list. So, if Project A is selected and you want to pick a responsible party for project A, it sets the validation in Range(“B(whatever row you are on)” to be A_Responsible, thus giving you that list.

    Private Sub Worksheet_Change(ByVal Target As Range)
    
    Dim wks As Worksheet
    Dim strName As String, strFormula
    Dim rng As Range
    
    Set wks = ActiveSheet
    
    With wks
    
        If Target.Row = 1 Then Exit Sub
    
        Select Case Target.Column
    
            Case Is = .Rows(1).Find("Project", lookat:=xlWhole).Column
    
                Set rng = Target.Offset(, 1)
    
                strName = Target.Value
                strFormula = "=" & Replace(strName, " ", "_") & "_Responsible"
    
                AddValidation rng, 1, strFormula
    
                'add any more cells that would need validation based on project selection here.
    
            Case Is = .Rows(1).Find("Responsible", lookat:=xlWhole).Column
    
                Set rng = Target.Offset(, 1)
    
                strName = Target.Value
                strFormula = "=" & Replace(strName, " ", "_") & "_SamplePoint"
    
                AddValidation rng, 1, strFormula
    
                'add any more cells that would need validation based on responsible selection here.
    
            'Case Is = add any more dependenices here ... and continue with cases for each one
    
        End Select
    
    End With
    

    You will also need this function in a standard module somewhere in your workbook.

    Function AddValidation(ByVal rng As Range, ByVal iOperator As Integer, _
        ByVal sFormula1 As String, Optional iXlDVType As Integer = 3, _
        Optional iAlertStyle As Integer = 1, Optional sFormula2 As String, _
        Optional bIgnoreBlank As Boolean = True, Optional bInCellDropDown As Boolean = True, _
        Optional sInputTitle As String, Optional sErrorTitle As String, _
        Optional sInputMessage As String, Optional sErrorMessage As String, _
        Optional bShowInput As Boolean = True, Optional bShowError As Boolean = True)
    
    '==============================================
    'Enumaration for ease of use
    'XlDVType
    'Name Value Description
    'xlValidateCustom 7 Data is validated using an arbitrary formula.
    'xlValidateDate 4 Date values.
    'xlValidateDecimal 2 Numeric values.
    'xlValidateInputOnly 0 Validate only when user changes the value.
    'xlValidateList 3 Value must be present in a specified list.
    'xlValidateTextLength 6 Length of text.
    'xlValidateTime 5 Time values.
    'xlValidateWholeNumber 1 Whole numeric values.
    
    'AlertStyle
    'xlValidAlertInformation 3 Information icon.
    'xlValidAlertStop 1 Stop icon.
    'xlValidAlertWarning 2 Warning icon.
    
    'Operator
    'xlBetween 1 Between. Can be used only if two formulas are provided.
    'xlEqual 3 Equal.
    'xlGreater 5 Greater than.
    'xlGreaterEqual 7 Greater than or equal to.
    'xlLess 6 Less than.
    'xlLessEqual 8 Less than or equal to.
    'xlNotBetween 2 Not between. Can be used only if two formulas are provided.
    'xlNotEqual 4 Not equal.
    '==============================================
    
    With rng.Validation
        .Delete ' delete any existing validation before adding new one
        .Add Type:=iXlDVType, AlertStyle:=iAlertStyle, Operator:=iOperator, Formula1:=sFormula1, Formula2:=sFormula2
        .IgnoreBlank = bIgnoreBlank
        .InCellDropdown = bInCellDropDown
        .InputTitle = sInputTitle
        .ErrorTitle = sErrorTitle
        .InputMessage = sInputMessage
        .ErrorMessage = sErrorMessage
        .ShowInput = bShowInput
        .ShowError = bShowError
    End With
    
    
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have thousands of HTML files to process using Groovy/Java and I need to
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.