Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combobox Add Item
Hi,
An earlier post reply suggested that using AddItem for a ComboBox, I have been looking at this and could do with a little more advice please. I need a ComboBox to give a range of options that are dependant upon a listbox. I then need a second combobox to take the 1st combobox selected value and give further choices. I have created the named ranges, these are - (1) UNIT, (2) categories and (3) Options. So, categories is dependant upon Unit and Options are then dependant upon categories. Can someone advise the code to reference the listbox and then populate the comboboxes please. Any help or a url would be excellent, Mickey |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combobox Add Item
Hi Mickey
You can use this 0 = the first item in the listbox Private Sub ListBox1_Click() If Me.ListBox1.ListIndex = 0 Then Me.ComboBox1.List = Sheets("sheet1").Range("UNIT").Value ' other code End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "MBlake" wrote in message ... Hi, An earlier post reply suggested that using AddItem for a ComboBox, I have been looking at this and could do with a little more advice please. I need a ComboBox to give a range of options that are dependant upon a listbox. I then need a second combobox to take the 1st combobox selected value and give further choices. I have created the named ranges, these are - (1) UNIT, (2) categories and (3) Options. So, categories is dependant upon Unit and Options are then dependant upon categories. Can someone advise the code to reference the listbox and then populate the comboboxes please. Any help or a url would be excellent, Mickey |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combobox Add Item
Hi Ron,
Many thanks for your kind reply. I have been a little slow in responding as I am struggling with this. Can you explain what the line 'other code' refers to please. Thanks, Mickey "Ron de Bruin" wrote in message ... Hi Mickey You can use this 0 = the first item in the listbox Private Sub ListBox1_Click() If Me.ListBox1.ListIndex = 0 Then Me.ComboBox1.List = Sheets("sheet1").Range("UNIT").Value ' other code End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "MBlake" wrote in message ... Hi, An earlier post reply suggested that using AddItem for a ComboBox, I have been looking at this and could do with a little more advice please. I need a ComboBox to give a range of options that are dependant upon a listbox. I then need a second combobox to take the 1st combobox selected value and give further choices. I have created the named ranges, these are - (1) UNIT, (2) categories and (3) Options. So, categories is dependant upon Unit and Options are then dependant upon categories. Can someone advise the code to reference the listbox and then populate the comboboxes please. Any help or a url would be excellent, Mickey |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combobox Add Item
Hi Mickey
In the example if you select the first item in the listbox it will fill the first combo with this line Me.ComboBox1.List = Sheets("sheet1").Range("UNIT").Value Maybe you want to fill more comboboxes with a range that's why I add the ' other code in the example You can use another If...End If for the second item in the listbox If Me.ListBox1.ListIndex = 1 Then 'your code End If -- Regards Ron de Bruin http://www.rondebruin.nl "MBlake" wrote in message ... Hi Ron, Many thanks for your kind reply. I have been a little slow in responding as I am struggling with this. Can you explain what the line 'other code' refers to please. Thanks, Mickey "Ron de Bruin" wrote in message ... Hi Mickey You can use this 0 = the first item in the listbox Private Sub ListBox1_Click() If Me.ListBox1.ListIndex = 0 Then Me.ComboBox1.List = Sheets("sheet1").Range("UNIT").Value ' other code End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "MBlake" wrote in message ... Hi, An earlier post reply suggested that using AddItem for a ComboBox, I have been looking at this and could do with a little more advice please. I need a ComboBox to give a range of options that are dependant upon a listbox. I then need a second combobox to take the 1st combobox selected value and give further choices. I have created the named ranges, these are - (1) UNIT, (2) categories and (3) Options. So, categories is dependant upon Unit and Options are then dependant upon categories. Can someone advise the code to reference the listbox and then populate the comboboxes please. Any help or a url would be excellent, Mickey |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combobox Add Item
Cheers Ron,
I'll get back to the code now and see what I can work out. I really appreciate your help and am enjoying Excel despite the headaches :-) Mickey |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
item limit for a combobox? | Excel Worksheet Functions | |||
Removing item from combobox with vba | Excel Programming | |||
Removing item from combobox with vba | Excel Programming | |||
Removing item from combobox with vba | Excel Programming | |||
ComboBox and select item | Excel Programming |