![]() |
moving cursor to a text box
I'm using the code below to check for the length of data a
user has entered in a text box. Private Sub In_ExpBr_Exit(ByVal cancel As MSForms.ReturnBoolean) If Len(In_ExpBr) < 2 Then MsgBox "Please enter a valid branch number." End If End Sub The user enters data into 5 text boxes. This code is attached to the 3rd text box. After they click okay, the message box goes away and the cursor is in the 4th text box. What can I add so that the cursor goes back to the 3rd text box where they fix the branch number to be 2 characters. Thanks for the help......... |
moving cursor to a text box
JT,
Try adding Cancel = True to your code before End If Regards Neil Private Sub In_ExpBr_Exit(ByVal cancel As MSForms.ReturnBoolean) If Len(In_ExpBr) < 2 Then MsgBox "Please enter a valid branch number." Cancel = True End If End Sub "JT" wrote in message ... I'm using the code below to check for the length of data a user has entered in a text box. Private Sub In_ExpBr_Exit(ByVal cancel As MSForms.ReturnBoolean) If Len(In_ExpBr) < 2 Then MsgBox "Please enter a valid branch number." End If End Sub The user enters data into 5 text boxes. This code is attached to the 3rd text box. After they click okay, the message box goes away and the cursor is in the 4th text box. What can I add so that the cursor goes back to the 3rd text box where they fix the branch number to be 2 characters. Thanks for the help......... |
All times are GMT +1. The time now is 05:06 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com