Hi,
Below is some code that I'm using in a userform.
Country is the combobox name. If the user types in a country name incorrectly, it removes the last incorrect letter. The problem is, because the code runs when the value of the combobox is changed, it keeps looping and all the letters in the textbox end up being removed.
Here's the code:
Private Sub Country_Change()
If Country.MatchFound = True Then Exit Sub
Country.Text = Left(Country.Text, Len(Country.Text) - 1)
Country.SelStart = Len(Country.Text)
End Sub
Is there a way to force the code to stop looping?
Thanks
Ben
Below is some code that I'm using in a userform.
Country is the combobox name. If the user types in a country name incorrectly, it removes the last incorrect letter. The problem is, because the code runs when the value of the combobox is changed, it keeps looping and all the letters in the textbox end up being removed.
Here's the code:
Private Sub Country_Change()
If Country.MatchFound = True Then Exit Sub
Country.Text = Left(Country.Text, Len(Country.Text) - 1)
Country.SelStart = Len(Country.Text)
End Sub
Is there a way to force the code to stop looping?
Thanks
Ben