03856me
Active Member
- Joined
- Apr 4, 2008
- Messages
- 297
I have pieced together the following code to link my second combo box based on the value of the first combo box. I have a couple of issues that I could use your help with to make this more functional. Once this code is working then I will apply it to about 6 other combo boxes.
Specifics: I have a "lookupTable" on the "Lookups" tab that contains many columns of data starting in column 13.
Issue#1 - my code duplicates the values in column 14 when filtering it.
Issue#2 - this is a table, is there a way to use the table[column] names instead of 1000 rows, that way when the table grows all is well?
I am open to another way to doing this - most efficient is what I am looking for.
Specifics: I have a "lookupTable" on the "Lookups" tab that contains many columns of data starting in column 13.
Issue#1 - my code duplicates the values in column 14 when filtering it.
Issue#2 - this is a table, is there a way to use the table[column] names instead of 1000 rows, that way when the table grows all is well?
I am open to another way to doing this - most efficient is what I am looking for.
Code:
Private Sub cbo_group_change()
Dim I As Long
Dim ws As Worksheet
Set ws = Worksheets("Lookups")
cbo_kiln.Clear
[COLOR=seagreen] 'I would like to use the table column name here instead of 1000 rows[/COLOR]
For I = 13 To ws.Cells(1000, 13).End(xlUp).Row
If ws.Cells(I, 13) = cbo_group.Value Then
cbo_kiln.AddItem ws.Cells(I, 14)
End If
Next I
End Sub