G
Guest
Hi everyone,
I made a userform that has some option buttons and two comboboxes. The user
choses from the two groups of option buttons and then goes to the first
combobox. I want the information in the second combobox to change depending
on what the person choses from the first combobox. I am having some problems.
It works well the first time but if the user changes their mind (i.e. choses
something else in the first combobox) the second combobox does not respond.
It clears and no new information is put in
Here is my code
COMMANDBUTTON3 ACTIVATES THE CHANGING OF COMBOBOX2, DEPENDING ON COMBOBOX1
INFORMATION
Private Sub CommandButton3_Click()
If Why.ComboBox1.Text = "-KAJ" Then
Why.ComboBox2.Clear
'Filling second combobox
Dim j As Integer
j = 2
Do Until IsEmpty(Cells(4, j))
prod = Workbooks("specs.xls").Worksheets("ProductIdentity").Cells(4, j)
Why.ComboBox2.AddItem (prod)
j = j + 1
Loop
ActiveWorkbook.Sheets("Blank").Select
End If
If Why.ComboBox1.Text = "-AA" Then
'Filling second combobox
Why.ComboBox2.Clear
Dim k As Integer
k = 2
Do Until IsEmpty(Cells(2, k))
prod = Workbooks("specs.xls").Worksheets("ProductIdentity").Cells(2, k)
Why.ComboBox2.AddItem (prod)
k = k + 1
Loop
ActiveWorkbook.Sheets("Blank").Select
End If
End Sub
Thanks for any help
I made a userform that has some option buttons and two comboboxes. The user
choses from the two groups of option buttons and then goes to the first
combobox. I want the information in the second combobox to change depending
on what the person choses from the first combobox. I am having some problems.
It works well the first time but if the user changes their mind (i.e. choses
something else in the first combobox) the second combobox does not respond.
It clears and no new information is put in
Here is my code
COMMANDBUTTON3 ACTIVATES THE CHANGING OF COMBOBOX2, DEPENDING ON COMBOBOX1
INFORMATION
Private Sub CommandButton3_Click()
If Why.ComboBox1.Text = "-KAJ" Then
Why.ComboBox2.Clear
'Filling second combobox
Dim j As Integer
j = 2
Do Until IsEmpty(Cells(4, j))
prod = Workbooks("specs.xls").Worksheets("ProductIdentity").Cells(4, j)
Why.ComboBox2.AddItem (prod)
j = j + 1
Loop
ActiveWorkbook.Sheets("Blank").Select
End If
If Why.ComboBox1.Text = "-AA" Then
'Filling second combobox
Why.ComboBox2.Clear
Dim k As Integer
k = 2
Do Until IsEmpty(Cells(2, k))
prod = Workbooks("specs.xls").Worksheets("ProductIdentity").Cells(2, k)
Why.ComboBox2.AddItem (prod)
k = k + 1
Loop
ActiveWorkbook.Sheets("Blank").Select
End If
End Sub
Thanks for any help