Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to write code so that when the value entered
in a textbox does not meet certain criteria, the text in the textbox is selected for correction by the user. Please see the code below. Once the user presses the tab key the message is displayed but the focus is lost and goes on to the next textbox or next frame if the textbox is the last one in the current frame. I have tried before update and change as well as exit. What am I doing wrong? How can I get it to go back and highlight the textbox with incorrect text/value. Thanks for your help. Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) If TextBox1.Value < 100 Then msgbox "You must enter ....." TextBox1.SetFocus TextBox1.SelStart = 0 TextBox1.SelLength = Len(TextBox1.Text) End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Exit Sub | Excel Discussion (Misc queries) | |||
Run when exit | Excel Worksheet Functions | |||
exit object | Excel Discussion (Misc queries) | |||
on exit macro | Excel Discussion (Misc queries) | |||
Exit Sub? | Excel Programming |