PDA

View Full Version : ComboBox's linked loop Crash HELP!!!



igorski88
06-12-2013, 11:17 AM
Hello,
I have two different tabs with a combo box in each I fill Both Combobox's with a list when the WorkBook opens. I am trying to link both combobox's. If combo box on Tab 1 changes then also change combo box on tab 2. This is all pretty easy but when custom text is received then that's when it creates a loop between themselves and crash. I think i need a "on loop end sub" or something rather Please help!!!! Thank in advance

TAB 1

Private Sub ComboBox9_Change()Sheet2.Range("AE4").Value = ComboBox9.TextSheet2.ComboBox10.Text = ComboBox9.TextWith ComboBox9 'See if the text is in the list If .ListIndex > -1 Then Sheet2.Range("AE5").Value = .List(.ListIndex, 1) 'Colomn 2 Else Sheet2.Range("AE5").Value = "" 'clear out the cell becouse the text entered is Custom End IfEnd With

TAB 2


Private Sub ComboBox10_Change()Sheet2.Range("AE4").Value = ComboBox10.TextSheet4.ComboBox9.Text = ComboBox10.Text 'copy to AUTO tab 'See if the text is in the listWith ComboBox10 If .ListIndex > -1 Then Sheet2.Range("AE5").Value = .List(.ListIndex, 1) Else Sheet2.Range("AE5").Value = "" 'clear out the cell becouse the text entered is Custom End IfEnd With End Sub

p45cal
06-13-2013, 03:00 AM
Could you not just put a big If..End If round all or most of the code in each of these event codes? Something along the loines of:
If Sheet18.Range("AE4").Value <> ComboBox9.Text then…
or:
if Sheet18.ComboBox10.Text <> ComboBox9.Text then…