ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dynamic combo box (https://www.excelbanter.com/excel-programming/284324-dynamic-combo-box.html)

TO

Dynamic combo box
 
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

Ron de Bruin

Dynamic combo box
 
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


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"TO" wrote in message ...
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





All times are GMT +1. The time now is 10:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com