PDA

View Full Version : Linking 2 Combo Boxes Together?



afslaughter
04-02-2011, 07:12 AM
I have 2 combo boxes 1 on the Task Sheet and 1 on the Insp Sheet I wanted to link them together but its not working. I am using the same code on another set of combo boxes and it works. I can't figure whats going on.

here is the code for the set that works:

Insp Sheet:
Private Sub ComboBoxAreaI_DropButtonClick()
ComboBoxAreaI.List = Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
End Sub
Private Sub ComboBoxAreaI_Change()
Application.EnableEvents = False
Sheets("Data").Range("O8") = ComboBoxAreaI.Value
Sheets("Task Input").ComboBoxAreaT.Value = ComboBoxAreaI.Value
Application.EnableEvents = True
End Sub

Task Sheet:
Private Sub ComboBoxAreaT_DropButtonClick()
ComboBoxAreaT.List = Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
End Sub
Private Sub ComboBoxAreaT_Change()
Application.EnableEvents = False
Sheets("Data").Range("O8") = ComboBoxAreaT.Value
Sheets("Insp Input").ComboBoxAreaI.Value = ComboBoxAreaT.Value
Application.EnableEvents = True
End Sub

This one dose not???

Insp Sheet:
Private Sub ComboBoxWCI_DropButtonClick()
Sheets("Insp Input").ComboBoxWCI.ListFillRange = "WCList"
End Sub
Private Sub ComboBoxWCI_Change()
Application.EnableEvents = False
Sheets("Data").Range("O4") = ComboBoxWCI.Value
Sheets("Task Input").ComboBoxWCT.Value = ComboBoxWCI.Value
Application.EnableEvents = True
End Sub

Task Sheet:
Private Sub ComboBoxWCT_DropButtonClick()
Sheets("Task Input").ComboBoxWCT.ListFillRange = "WCList"
End Sub
Private Sub ComboBoxWCT_Change()
Application.EnableEvents = False
Sheets("Data").Range("O4") = ComboBoxWCT.Value
Sheets("Insp Input").ComboBoxWCI.Value = ComboBoxWCT.Value
Application.EnableEvents = True
End Sub

Bob Phillips
04-02-2011, 07:46 AM
Seems to work for me. What is not working for you?

afslaughter
04-02-2011, 10:25 AM
The Insp Sheet will update the Task Sheet but not vis versa. I looked at the properties and with the name i get a ambiguous name detected, but I don't see anything else with the same name. One more thing I found the change event runs when I change anything on the workbook. Its good to know the code is solid but the objects behaver is a real mystery.

afslaughter
04-06-2011, 05:08 AM
I am still having problems with this one. I have tried deleting the combo boxes and making new one with the standard names and I am still having this problem. it seems the Application.EnableEvents = False is not working and for some reason the ComboBox1_Change code runs when anything on the worksheet is changed. I really can't figure this out. Can anyone help please.