Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA - Help with Code (see message)


I have written the following code to protect against a formula error i
the end user does not enter a number in the textboxes.

Private Sub TextBox40_AfterUpdate()
If TextBox40 = "" And Not IsNumeric(TextBox40) Then
MsgBox "Number Expected Here"
TextBox40.Text = ""
End If


The problem is that everytime I hit tab or enter the MsgBox fires an
the cursor jumps to the next textbox in the tab order. What I want t
happen is the MsgBox only display is a nonnumeric entry was made an
then clear the textbox but remain in it for a new entry.

Any suggestions?? Maybe someone could tell me the code to have th
cursor stay in TextBox40 if the entry is not numeric.

Thanks

--
bforster
-----------------------------------------------------------------------
bforster1's Profile: http://www.excelforum.com/member.php...fo&userid=1177
View this thread: http://www.excelforum.com/showthread.php?threadid=27583

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA - Help with Code (see message)


did you try TextBox.SetFocus...? for example:

Private Sub TextBox40_AfterUpdate()
If TextBox40 = "" And Not IsNumeric(TextBox40) Then
MsgBox "Number Expected Here"
TextBox40.Text = ""
TextBox40.SetFocus
End If


- Manges

--
mangesh_yada
-----------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047
View this thread: http://www.excelforum.com/showthread.php?threadid=27583

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
Code Execution Message canderson Excel Discussion (Misc queries) 1 October 9th 09 04:28 PM
code -message box not messaging Wanna Learn Excel Discussion (Misc queries) 1 January 21st 09 05:03 PM
code break message box freekrill Excel Discussion (Misc queries) 2 November 29th 05 05:26 PM
Help with Error Message Box code Cutter[_11_] Excel Programming 2 July 9th 04 07:31 PM
Message box that does not interrupt code Claude Excel Programming 2 October 10th 03 04:12 PM


All times are GMT +1. The time now is 07:42 PM.

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"