Hi.
I'm hoping this is something simple that can be fixed. What i am trying to do is i have a userform with 2 combo boxes. The first combo box has a validation list i am pulling from a sheet with the following code:
Private Sub UserForm_Initialize()
Me.Combobox1.RowSource = Sheets("Data").Range("B1").Validation.Formula1
Me.Combobox1.Value = Sheets("Data").Range("B1")
End If
End Sub
What i need is when the user selects a value in the first combo box, only certain values for the second combobox that are applicable to the value in the first combo box should show. This is the code i have tried to use but had no luck.
Private Sub UserForm_Initialize()
Me.Combobox1.RowSource = Sheets("Data").Range("B1").Validation.Formula1
Me.Combobox1.Value = Sheets("Data").Range("B1")
If Combobox1.Value = "Test1" Then
Me.Combobox2.RowSource = Sheets("Data").Range("D1").Validation.Formula1
Me.Combobox2.Value = Sheets("Data").Range("D1")
ElseIf Combobox1.Value = "Test2" Then
Me.Combobox2.RowSource = Sheets("Data").Range("D2").Validation.Formula1
Me.Combobox2.Value = Sheets("Data").Range("D2")
End If
End Sub
So if i pick Test1 from combobox1, the validation list in cell D1 should be filled into combobox2 however this is not the case. If i pick Test1, combobox2 has no values in it.
Any help is appreciated!
Bookmarks