I have a textbox to which I have assigned some code so that 6 digit numbers are displayed split 3 & 3 with a space between each set and uploaded to the worksheet as "nnn nnn". This is also the format that successfully returns to the userform following a successful search.
The Code is
Private Sub txtUnitNumber_AfterUpdate()
txtUnitNumber.Text = Left(txtUnitNumber, 3) & " " & Right(txtUnitNumber, 3)
End Sub
After I use the Add, Clear or Update commands I want the userform to remain on the screen and be ready for the next action. However when I use these command buttons , the cursor appears in position 2 of the textbox.
My code in all three instances the code includes the instruction Call UserForm_Initialize.
Can someone suggest some code that will clear the userform and set the focus in the "txtUnitNumber" textbox so the cursor appears in position 1. I am sure that this has something to do with the re-formatting code (as Above)
All suggestions are most welcome
The Code is
Private Sub txtUnitNumber_AfterUpdate()
txtUnitNumber.Text = Left(txtUnitNumber, 3) & " " & Right(txtUnitNumber, 3)
End Sub
After I use the Add, Clear or Update commands I want the userform to remain on the screen and be ready for the next action. However when I use these command buttons , the cursor appears in position 2 of the textbox.
My code in all three instances the code includes the instruction Call UserForm_Initialize.
Can someone suggest some code that will clear the userform and set the focus in the "txtUnitNumber" textbox so the cursor appears in position 1. I am sure that this has something to do with the re-formatting code (as Above)
All suggestions are most welcome