Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a couple textboxes on my userform, but I am mostly
interested in Textbox3. Once a user enters string data into Textbox3 and presses the Enter key I would immediately like to check the string. If the string is NOT valid, I would like the clear out the invalid string from Textbox3. This will tell the user that the typed data was invalid and that they need to re-type the data again. If the data IS valid, I would like the focus to leave Textbox3 (and possibly go to Textbox1) Does this involve using "TextBox3_AfterUpdate", "TextBox3_Exit", and the Setfocus() function??? I'm not sure how to set this up. Please help. thank you |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Private Sub TextBox3_Change() If IsNumeric(Me.TextBox1) Then Me.TextBox3.SetFocus end if End Sub -- joel ------------------------------------------------------------------------ joel's Profile: 229 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=170811 Microsoft Office Help |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Robert,
Pressing Enter will effectively tab away from teh text box so you could use the Exit event. You could perhaps negate the need to trap a valid value by setting the tab order so that TextBox1 is next in line and will get the focus when enter is pressed with a valid string in TextBox3. Private Sub TextBox3_Exit(ByVal Cancel As MSForms.ReturnBoolean) with TextBox3 If .text = 'whatever isn't valid then .text = "" .setfocus end if end with End Sub Libby x "Robert Crandal" wrote: I have a couple textboxes on my userform, but I am mostly interested in Textbox3. Once a user enters string data into Textbox3 and presses the Enter key I would immediately like to check the string. If the string is NOT valid, I would like the clear out the invalid string from Textbox3. This will tell the user that the typed data was invalid and that they need to re-type the data again. If the data IS valid, I would like the focus to leave Textbox3 (and possibly go to Textbox1) Does this involve using "TextBox3_AfterUpdate", "TextBox3_Exit", and the Setfocus() function??? I'm not sure how to set this up. Please help. thank you . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Show Results in TextBoxes, ONLY if All TextBoxes have Data in them | Excel Programming | |||
Textboxes | Excel Discussion (Misc queries) | |||
Events for Enter/Exit Textboxes on Userforms | Excel Programming | |||
Textboxes | Excel Programming | |||
Textboxes | Excel Programming |