Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
populating one list/combobox based on the results of another
Hi,
I'd be grateful if someone could help with what i think is probably quite a simple thing (just not as simple as me). I have a userform with two comboboxes; the data for these come from one data-table. combobox1 is filled with the table heading data (ie, from a single row) and this works fine; what i can't do is populate the the second combobox with the column of data in the data-table below the relevant header (as chosen in the first combobox). i want the population to be programmatic / dynamic as the table is likely to change over time. hope someone can help, cheers, tim |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
populating one list/combobox based on the results of another
"Tim" wrote in message ... Hi, I'd be grateful if someone could help with what i think is probably quite a simple thing (just not as simple as me). I have a userform with two comboboxes; the data for these come from one data-table. combobox1 is filled with the table heading data (ie, from a single row) and this works fine; what i can't do is populate the the second combobox with the column of data in the data-table below the relevant header (as chosen in the first combobox). i want the population to be programmatic / dynamic as the table is likely to change over time. hope someone can help, cheers, tim apologies for replying to my own post - i've cobbled together something that works (see below) - can anyone improve it, eg, i must be able to do it without actually selecting cells? no worries if not, as i've got the thing basically working now. cheers tim Private Sub ComboBox1_AfterUpdate() ComboBox2.Enabled = True On Error Resume Next Dim FindValue As String FindValue = ComboBox1.Value Application.Goto Reference:="rngsite" Selection.Find(What:=FindValue, After:=ActiveCell, LookIn:=xlValues, _ LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Select UserForm1.ComboBox2.Clear ActiveCell.Offset(1, 0).Select Do Until ActiveCell.Value = "" UserForm1.ComboBox2.AddItem ActiveCell.Value ActiveCell.Offset(1, 0).Select Loop End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Populating a data validation list based on criteria | Excel Discussion (Misc queries) | |||
Populating other cells based on a choice from a drop-down list | Excel Discussion (Misc queries) | |||
.AddItem list and populating combobox with created list | Excel Discussion (Misc queries) | |||
Filter the results of a list based on a previous vlookup against the same list | Excel Worksheet Functions | |||
Combobox populating based on Option Button | Excel Programming |