(Solved) – excel vba userform afterupdate fires when text box cleared


I have a simple userform with 5 text boxes. I can process the data using an “ADD” command button but, given that there could be 100 entries in one session it would be a bit quicker and easier if the procedure is fired with a sub [last textbox]_afterupdate().

Problem: when clearing the textboxes, the last one fires the procedure again. Here is the code:

Private Sub txtagainst2_afterupdate()

Set rTeam = [A4:A50].Find(txtTeam, lookat:=xlWhole)
Set rTeam = rTeam.Resize(1, 15)
With rTeam
    code to do stuff with the textbox values
End With
txtTeam = ""
txtFor1 = ""
txtAgainst1 = ""
txtFor2 = ""
txtAgainst2 = ""

End Sub

I’ve tried a few possibilities, but cannot crack it.

Any advice or solution would be truly appreciated.

Thank you, Peter

Leave a Reply

Your email address will not be published. Required fields are marked *