Using Filtered Data for ComboBox

C

cdos

I am pretty green when it comes to VBA, actually very green. But what
am looking for is some idea of what some code would look like for th
following:

Say I have 6 options to choose from in the first ComboBox, however eac
of those options have 10 subsets. What I am looking for is code tha
will adjust the second ComboBox to show the correct subsets based o
the first selected data in the first ComboBox.

Anything would help, if my description is too confusing please tell me
Thanks to anyone who takes the time to help me
 
D

Dave Peterson

I put a couple of comboboxes from the control toolbox toolbar on a worksheet.

I put the listfillrange for the first combobox on a different sheet.

Then in the code for that first combobox, I had this:

Option Explicit
Private Sub ComboBox1_Change()

Dim myCell As Range

With Me.ComboBox2
.Clear
For Each myCell In Application.Range(Me.ComboBox1.ListFillRange)
If myCell.Text = Me.ComboBox1.Value Then
.AddItem myCell.Offset(0, 1).Value
End If
Next myCell
End With

End Sub
 
Top