2 combo boxes

G

Greg

I have 2 combo boxes and depending on the choice in combo 1 I want combo 2
box to change choices. Is this possible. thx, greg
 
I

IC

Using VBA you can specify the ListFillRange for ComboBox2.

Private Sub ComboBox1_LostFocus()
If ComboBox1.Value = "Option1" Then
ComboBox2.ListFillRange = "B1:B3"
ElseIf ComboBox1.Value = "Option2" Then
ComboBox2.ListFillRange = "C1:C3"
ElseIf ComboBox1.Value = "Option3" Then
ComboBox2.ListFillRange = "D1:D3"
End If
End Sub

You can also clear the CB2 displayed entry when selecting CB1 with this

Private Sub ComboBox1_GotFocus()
ComboBox2.Value = ""
End Sub

otherwise CB2 continues to display the last selected item until you change
it.

Ian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top