Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default 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.........
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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.........



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
moving cursor in a macro Amanda Excel Discussion (Misc queries) 3 June 18th 09 03:09 AM
moving the cursor in a macro Amanda Excel Discussion (Misc queries) 1 June 18th 09 02:05 AM
moving cursor PECOSBOB Excel Worksheet Functions 1 January 17th 09 01:27 PM
moving cursor aby New Users to Excel 2 November 2nd 08 10:45 PM
Moving cursor around excel Rare Earth Excel Discussion (Misc queries) 1 October 7th 08 11:52 PM


All times are GMT +1. The time now is 06:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"