How can i refresh the list in one active x combo box when another is triggered?

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,

Ok so i have two activex combo boxes on a sheet and i want to refesh the inputs for combobox1
when i select something in combo box 2

To give you an idea of what i'm trying to do heres my code:
VBA Code:
Private Sub ComboBox2_Change()
Application.EnableEvents = False
ActiveSheet.Unprotect
With ThisWorkbook.Worksheets("Selection")
.ComboBox1.ListFillRange = "Colour_Dropdown1"
End With
ActiveSheet.Protect
Application.EnableEvents = True
End Sub

now the problem I'm getting is it doesn't seam to only be triggering when i make a change to combobox2?

So what am i doing wrong?
can someone please help me with the correct code?
Its current placed in the sheet module area.

So to sum up,

"Colour_Dropdown1" is a named range, the data in this range changes when you select a name in combobox2
to get combobox1 to update i have to manually repaste in the ListFillRange as "Colour_Dropdown1" so i want the macro to do this for me, or any other way i can do this is fine.
hope thats clear.
please help if you can

Thanks

Tony
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Try this
Rich (BB code):
Private Sub ComboBox2_Change()
    Application.EnableEvents = False
    ActiveSheet.Unprotect
    With ThisWorkbook.Worksheets("Selection")
        .ComboBox1.ListFillRange = ThisWorkbook.Names("Colour_Dropdown1").RefersTo
    End With
    ActiveSheet.Protect
    Application.EnableEvents = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,849
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top