Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
item limit for a combobox? KarenH Excel Worksheet Functions 3 July 20th 06 09:30 PM
Removing item from combobox with vba SOS[_36_] Excel Programming 0 September 24th 04 02:03 PM
Removing item from combobox with vba SOS[_35_] Excel Programming 1 September 24th 04 01:49 PM
Removing item from combobox with vba SOS[_34_] Excel Programming 1 September 24th 04 01:28 PM
ComboBox and select item Soniya Excel Programming 5 August 23rd 03 11:18 AM


All times are GMT +1. The time now is 02:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"