![]() |
Textboxes on userforms
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 |
Textboxes on userforms
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 |
Textboxes on userforms
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 . |
All times are GMT +1. The time now is 10:37 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com