Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Combo Box Help


Hi all, hopefully someone can help me out.

I have created a combo box (from the control toolbox), and have
assigned a linked cell and a list fill range.

I now want to create a 2nd combo box, that will bring back a second set
of results based on the outcome of the first combo box.

I know this can be done using data validation, however I am trying to
get it done through VBA, so I can design a form for my colleagues to
use.

If the above was unclear, think Car manufacturers and models, depending
on what car manufactuer is selected (viabox 1), I want only certain
models to be shown in box2.

Any help would be appreciated.


--
towl
------------------------------------------------------------------------
towl's Profile: http://www.excelforum.com/member.php...o&userid=26340
View this thread: http://www.excelforum.com/showthread...hreadid=477582

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Combo Box Help

In the click even of the first combobox, populate the second using add item


Private Sub Combobox1_Click()
Dim rng as Range
set rng = Range(combobox1.ListFillRange)
' combobox2 should not have a listfillrange assignment
Combobox2.Clear
for each cell in rng
if cell.Value = Combobox1.Value then
Combobox2.AddItem cell.offset(0,1).Value
end if
Next
End Sub

--
Regards,
Tom Ogilvy

"towl" wrote in message
...

Hi all, hopefully someone can help me out.

I have created a combo box (from the control toolbox), and have
assigned a linked cell and a list fill range.

I now want to create a 2nd combo box, that will bring back a second set
of results based on the outcome of the first combo box.

I know this can be done using data validation, however I am trying to
get it done through VBA, so I can design a form for my colleagues to
use.

If the above was unclear, think Car manufacturers and models, depending
on what car manufactuer is selected (viabox 1), I want only certain
models to be shown in box2.

Any help would be appreciated.


--
towl
------------------------------------------------------------------------
towl's Profile:

http://www.excelforum.com/member.php...o&userid=26340
View this thread: http://www.excelforum.com/showthread...hreadid=477582



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Combo Box Help


Thanks for the help Tom, but still doesn't seem to be working,


I have assigned a list name in Excel, that corresponds to the names i
the combobox1 list, and it is this that I am wanting to pick up, gues
I am trying to run before I can walk, as only started using Vba las
week.

Does anyone else have any ideas

--
tow
-----------------------------------------------------------------------
towl's Profile: http://www.excelforum.com/member.php...fo&userid=2634
View this thread: http://www.excelforum.com/showthread.php?threadid=47758

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Combo Box Help

Private Sub Combobox1_Click()
If Combobox1.ListIndex < -1 then
Combobox2.List = Range(Combobox1.Value).Value
End if
End Sub

If you tell the whole story in the beginning, you increase your chances of
getting a usable answer. Otherwise we have to guess to fill in the blanks.

--
Regards,
Tom Ogilvy


"towl" wrote in message
...

Thanks for the help Tom, but still doesn't seem to be working,


I have assigned a list name in Excel, that corresponds to the names in
the combobox1 list, and it is this that I am wanting to pick up, guess
I am trying to run before I can walk, as only started using Vba last
week.

Does anyone else have any ideas?


--
towl
------------------------------------------------------------------------
towl's Profile:

http://www.excelforum.com/member.php...o&userid=26340
View this thread: http://www.excelforum.com/showthread...hreadid=477582



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
linking a form combo box... results from the combo box to another Trey Excel Discussion (Misc queries) 1 July 15th 07 01:58 AM
combo reference on another combo box for picking address etc. kbjin Excel Worksheet Functions 1 December 8th 06 03:29 PM
Combo box values based on other combo box value JCanyoneer Excel Programming 1 April 5th 05 06:41 PM
"Combo Box - getting control combo box to stick in place in worksh ajr Excel Discussion (Misc queries) 1 February 16th 05 02:05 AM
"Combo Box - getting control combo box to stick in place in worksh ajr Excel Discussion (Misc queries) 0 February 15th 05 07:45 PM


All times are GMT +1. The time now is 02:59 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"