Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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......... |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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......... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
moving cursor in a macro | Excel Discussion (Misc queries) | |||
moving the cursor in a macro | Excel Discussion (Misc queries) | |||
moving cursor | Excel Worksheet Functions | |||
moving cursor | New Users to Excel | |||
Moving cursor around excel | Excel Discussion (Misc queries) |