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 8706255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:34:17+00:00 2026-06-13T03:34:17+00:00

I have three drop downs in my VBA form ( cbo_fac1 , cbo_fac2 ,

  • 0

I have three drop downs in my VBA form (cbo_fac1, cbo_fac2, cbo_fac3), each extracting data from the same source. But I would like to implement a cascade update on the group of select lists so that when the user picks an option from one it is removed from subsequent select lists.

For example if cbo_fac1 has the following options:

Blu-ray DVD Player
Chalk board
Computer 
Data projector
Data projector trolley

and the user selects Blu-ray DVD Player from cbo_fac1 then the next two drop downs (cbo_fac2 and cbo_fac3) should only have the following options available:

Chalk board
Computer 
Data projector
Data projector trolley

If the user then decides to pick Data projector trolley from cbo_fac2 then the next and final drop (cbo_fac3) down should only have the following options for selection:

Chalk board
Computer 
Data projector

Of course if the user decides to go back and change their options then this should also reflect. How would I go about achieving this. This is the code I have so far:

   For Each c_fac In ws_misc.Range("fac")
        With Me.cbo_fac1
        .AddItem c_fac.Value
        .List(.ListCount - 1, 1) = c_fac.Offset(0, 1).Value
         End With
        With Me.cbo_fac2
        .AddItem c_fac.Value
        .List(.ListCount - 1, 1) = c_fac.Offset(0, 1).Value
        End With
        With Me.cbo_fac3
        .AddItem c_fac.Value
        .List(.ListCount - 1, 1) = c_fac.Offset(0, 1).Value
        End With
      Next c_fac

Thanks in advance!

  • 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-13T03:34:18+00:00Added an answer on June 13, 2026 at 3:34 am

    This took longer than I thought. I thought it was going to be easier 🙂

    I would use a User Defined Type in VBA for this solution. Please see this example:

    Put this in a Module:

    Option Explicit
    
    Public Type listOptions
        name As String
        isUsed As Boolean
    End Type
    

    Add three combo boxes on a userform. Change the combo boxes to the names: cbo_fac1, cbo_fac2, cbo_fac3.

    Then add this code behind the userform:

    Option Explicit
    
    ' options needs to be persisted throughout the life of the program
    Dim options() As listOptions
    
    Private Sub UserForm_Initialize()
        ' setup options
        Call getOptionsFromWorksheet("Sheet1")
    
        fillComboBoxWithOptions "cbo_fac1"
        fillComboBoxWithOptions "cbo_fac2"
        fillComboBoxWithOptions "cbo_fac3"
    End Sub
    
    Private Sub getOptionsFromWorksheet(ByRef wsName As String)
        Dim ws As Excel.Worksheet
        Set ws = ThisWorkbook.Worksheets(wsName)
    
        ' assuming data begins at A1
        Dim lastCell As Long
        Dim i As Long
    
        lastCell = ws.Cells.SpecialCells(xlCellTypeLastCell).Row
    
        ReDim options(lastCell - 1)
    
        For i = 1 To lastCell
            options(i - 1) = createOption(ws.Cells(i, 1).Value)
        Next
    End Sub
    
    Private Function createOption(ByRef theName) As listOptions
        Dim opt As listOptions
        opt.name = theName
        opt.isUsed = False
        createOption = opt
    End Function
    
    
    Private Sub cbo_fac1_AfterUpdate()
        Call resetSelectedOptions
    
        ' reset other combo boxes with options
        fillComboBoxWithOptions "cbo_fac2"
        fillComboBoxWithOptions "cbo_fac3"
    End Sub
    
    Private Sub cbo_fac2_AfterUpdate()
        Call resetSelectedOptions
    
        ' reset other combo boxes with options
        fillComboBoxWithOptions "cbo_fac1"
        fillComboBoxWithOptions "cbo_fac3"
    End Sub
    
    Private Sub cbo_fac3_AfterUpdate()
        Call resetSelectedOptions
    
        ' reset other combo boxes with options
        fillComboBoxWithOptions "cbo_fac1"
        fillComboBoxWithOptions "cbo_fac2"
    End Sub
    
    ' Resets the combobox control with the available options
    Private Sub fillComboBoxWithOptions(ByRef comboBoxName)
        Dim selectedItem As String
    
        ' get and store the selected item, if any,
        ' so we can re-select it after we clear it out and re-fill it
        If (Me.Controls(comboBoxName).ListIndex <> -1) Then
            selectedItem = Me.Controls(comboBoxName).List(Me.Controls(comboBoxName).ListIndex)
        End If
    
        Me.Controls(comboBoxName).Clear
        Dim i As Long
        For i = 0 To UBound(options)
            If (options(i).name = selectedItem) Then
                Me.Controls(comboBoxName).AddItem options(i).name
            ElseIf (Not options(i).isUsed) Then
                Me.Controls(comboBoxName).AddItem options(i).name
            End If
        Next
    
        ' re-select the item
        For i = 0 To Me.Controls(comboBoxName).ListCount - 1
            If (Me.Controls(comboBoxName).List(i) = selectedItem) Then
                Me.Controls(comboBoxName).ListIndex = i
                Exit For
            End If
        Next
    End Sub
    
    Private Sub resetSelectedOptions()
        Dim i As Long
        For i = 0 To UBound(options)
            options(i).isUsed = False
        Next
    
        ' Since the list index will not match the index of the options() array
        ' we have to loop through until we find a matching name and set
        ' the isUsed = True
        If (cbo_fac1.ListIndex <> -1) Then
            For i = 0 To UBound(options)
                If (options(i).name = cbo_fac1.List(cbo_fac1.ListIndex)) Then
                    options(i).isUsed = True
                    Exit For
                End If
            Next
        End If
    
        If (cbo_fac2.ListIndex <> -1) Then
            For i = 0 To UBound(options)
                If (options(i).name = cbo_fac2.List(cbo_fac2.ListIndex)) Then
                    options(i).isUsed = True
                    Exit For
                End If
            Next
        End If
    
    
        If (cbo_fac3.ListIndex <> -1) Then
            For i = 0 To UBound(options)
                If (options(i).name = cbo_fac3.List(cbo_fac3.ListIndex)) Then
                    options(i).isUsed = True
                    Exit For
                End If
            Next
        End If
    
    End Sub
    

    The idea here is that after each combobox has been selected a value, that it would reset the other comboboxes using the AferUpdate event. It also takes into account if a combobox already had a value selected.

    Hope this helps

    EDIT:
    I changed the code to accommodate data in a worksheet. I named the sheet “Sheet1” (change this to whatever you need) and I’m assuming that in that worksheet that the ONLY data in there is the list of items you want to have listed (so, NO headers and NO other data in the worksheet at all).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple custom web part with three drop downs that reads from
i have three lists with the same number of elements in each other, i
I have a drop down select list in a VBA form I would like
I have three drop downs in mypage.php: <select name='vehicle'> <option value=''>Select</option> <option value='bus'>Bus</option> <option
So, I have three drop down lists that are related to each other: CountryDDL
Imagine you have a website with several drop-downs that are populated from the back-end
I have three controls on my web form of three drop down lists. I
I have three identical drop down lists that I'm populating using MySQL data. If
I have a set of three combo boxes (drop downs) that are populated by
I have a website with a search on it with 4 drop downs. Each

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.