Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Code Execution Message | Excel Discussion (Misc queries) | |||
code -message box not messaging | Excel Discussion (Misc queries) | |||
code break message box | Excel Discussion (Misc queries) | |||
Help with Error Message Box code | Excel Programming | |||
Message box that does not interrupt code | Excel Programming |