Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Linking multiple combo boxes

Hi All

Does anyone know where I can get the code to link several combo boxes .
so if the user selects the first box it will populate the second box with
specific values and if the user selects the second box it will populate the
third box with specific values.

any help will be greatly appreciated

Regards
Subs


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Linking multiple combo boxes

Subs,

Private Sub ComboBox1_Change()
ComboBox2.Text = ComboBox1.Text
ComboBox2.Value = ComboBox1.Value
End Sub

Alex A.
(If this was helpful please click the Yes button!)


"Subs" wrote:

Hi All

Does anyone know where I can get the code to link several combo boxes .
so if the user selects the first box it will populate the second box with
specific values and if the user selects the second box it will populate the
third box with specific values.

any help will be greatly appreciated

Regards
Subs



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Linking multiple combo boxes



Private Sub ComboBox1_Change()
Set rng=range(Combobox1.value & "_Models")
combobox2.clear
For each cell in rng
combobox2.additem cell.value
next cell
End Sub


"Subs" wrote:

Hi All

Does anyone know where I can get the code to link several combo boxes .
so if the user selects the first box it will populate the second box with
specific values and if the user selects the second box it will populate the
third box with specific values.

any help will be greatly appreciated

Regards
Subs



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Linking multiple combo boxes

Hi,
Sorry .. finger trouble on first post. Hope the following example
is what you want i.e selection from one combobox will populate another
combobox with a list of data.

Combobox1 is initiliazed with list of car manufacturers based on named range
"Manufacturers".

When combobox1 is selected, combobox2 is loaded with models from named
range; if manufacturer is "Ford" then named range is "Ford_Models".
Similarly, combobox3 is loaded with colours for a given model e.g. named
range "Fiesta_Colours" (UK car models here!)

You could use arrays of named ranges in combination with the ListIndex of a
combobox (or both) to get the date to be loaded.I personally think named
ranges are the best way of organising the data.

HTH

Private Sub Combobox1_Change()
Dim rng As Range, cell As Range
' Set combobox2 with list of models for given manufacturer
Set rng = Range(ComboBox1.Value & "_Models")
ComboBox2.Clear
For Each cell In rng
ComboBox2.AddItem cell.Value
Next cell
End Sub

Private Sub Combobox2_Change()
Dim rng As Range, cell As Range
' Set combobox3 with list of colours for given model
Set rng = Range(ComboBox2.Value & "_Colours")
ComboBox3.Clear
For Each cell In rng
ComboBox3.AddItem cell.Value
Next cell
End Sub

Private Sub Userform_Initialize()
Dim rng As Range, cell As Range
Set rng = Range("Manufacturers")
For Each cell In rng
ComboBox1.AddItem cell.Value
Next cell
End Sub

"Subs" wrote:

Hi All

Does anyone know where I can get the code to link several combo boxes .
so if the user selects the first box it will populate the second box with
specific values and if the user selects the second box it will populate the
third box with specific values.

any help will be greatly appreciated

Regards
Subs



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Linking multiple combo boxes

Subs,
I guess you need the item selected in ComboBox1 to be added to the list of
ComboBox2???
But do you want the list in combobox2 to grow with each selection of
combobox1????
In that case the he syntax would be something like this-

Private Sub ComboBox1_Change()
ComboBox2.AddItem ComboBox1.Value 'Or ComboBox1.Text
End Sub

We really need more information here.



"Subs" wrote:

Hi All

Does anyone know where I can get the code to link several combo boxes .
so if the user selects the first box it will populate the second box with
specific values and if the user selects the second box it will populate the
third box with specific values.

any help will be greatly appreciated

Regards
Subs





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
multiple combo boxes jeff Excel Discussion (Misc queries) 2 December 16th 08 05:02 PM
Linking Combo Boxes (Please Help) Mika Excel Worksheet Functions 0 January 8th 07 07:05 PM
multiple combo boxes LilyDog7 Excel Discussion (Misc queries) 4 October 17th 05 10:22 PM
Linking Combo Boxes dogo Excel Programming 3 September 30th 04 11:59 PM
excel 97: linking 2 combo boxes JMCN Excel Programming 1 October 22nd 03 11:05 PM


All times are GMT +1. The time now is 05:22 PM.

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

About Us

"It's about Microsoft Excel"