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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 11:14 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com