Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Private Sub CommandButton3_Click()
If Why.ComboBox1.Text = "-KAJ" Then Why.ComboBox2.Clear 'Filling second combobox Dim j As Integer j = 2 With Workbooks("specs.xls").Worksheets("ProductIdentity ") Do Until IsEmpty(.Cells(4, j)) prod = .Cells(4, j) Why.ComboBox2.AddItem (prod) j = j + 1 Loop End With ActiveWorkbook.Sheets("Blank").Select ElseIf Why.ComboBox1.Text = "-AA" Then 'Filling second combobox Why.ComboBox2.Clear Dim k As Integer k = 2 With Workbooks("specs.xls").Worksheets("ProductIdentity ") Do Until IsEmpty(.Cells(2, k)) prod = .Cells(2, k) Why.ComboBox2.AddItem (prod) k = k + 1 Loop End With ActiveWorkbook.Sheets("Blank").Select End If End Sub The macro is triggered by a change in the value of Combobox3. -- Regards, Tom Ogilvy "trini" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Problems with Combobox | Excel Programming | |||
ComboBox Problems | Excel Programming | |||
ComboBox problems !! | Excel Programming | |||
Combobox Visibility Problems | Excel Programming | |||
ComboBox Problems | Excel Programming |