Dynamic combo box

  • Thread starter Thread starter TO
  • Start date Start date
T

TO

Hello all,

Is it possible to have the'List Fill Range" in a combo
box change depending on the value of another cell.

i.e. if the user selects February, the list fill range is
C3:C9, if March is selected C10:C25, etc.

Thanks in advance
 
You can check the listindex in Combobox1 and fill in the list in combobox2

Private Sub UserForm_Initialize()
Application.EnableEvents = False
ComboBox1.List = Range("z1:z3").Value
ComboBox2.List = Range("a1:a3").Value
ComboBox1.ListIndex = 0
ComboBox2.ListIndex = 0
Application.EnableEvents = True
End Sub

Private Sub ComboBox1_Change()
ComboBox2.Clear
If ComboBox1.ListIndex = 0 Then ComboBox2.List = Range("a1:a3").Value
If ComboBox1.ListIndex = 1 Then ComboBox2.List = Range("b1:b3").Value
If ComboBox1.ListIndex = 2 Then ComboBox2.List = Range("c1:c3").Value
ComboBox2.ListIndex = 0
End Sub
 
Back
Top