Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default Textbox/Userform question

If I show a form which has 3 crucial textboxes that must
have user data in them.....can I return them to an empty
textbox before they are permitted to exit?

Maybe something like Select Case?

Regards.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Textbox/Userform question

Try:

If textbox1.value = "" Then
textbox1.setfocus
Exit Sub
ElseIf textbox2.value = "" Then
textbox2.setfocus
Exit Sub
ElseIf textbox3.value = "" Then
textbox3.setfocus
Exit Sub
End If

Let me know if you have any problems.

Mark

Stuart wrote:
If I show a form which has 3 crucial textboxes that must
have user data in them.....can I return them to an empty
textbox before they are permitted to exit?

Maybe something like Select Case?

Regards.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Textbox/Userform question

The command to 'activate' a textbox is SetFocus.

Also look at the SelStart and SelLength properties as well to make it even
nicer.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Stuart" wrote in message
...
If I show a form which has 3 crucial textboxes that must
have user data in them.....can I return them to an empty
textbox before they are permitted to exit?

Maybe something like Select Case?

Regards.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default Textbox/Userform question

Many thanks to you both.

Why, when the user is returned to the textbox, does the form not display
"from the top"?
(Presumably SetFocus controls this action, thus the textbox in question is
displayed top left in the window).
Can I display the form from the top, by default?

Regards.

"Mark Bigelow" wrote in message
oups.com...
Try:

If textbox1.value = "" Then
textbox1.setfocus
Exit Sub
ElseIf textbox2.value = "" Then
textbox2.setfocus
Exit Sub
ElseIf textbox3.value = "" Then
textbox3.setfocus
Exit Sub
End If

Let me know if you have any problems.

Mark

Stuart wrote:
If I show a form which has 3 crucial textboxes that must
have user data in them.....can I return them to an empty
textbox before they are permitted to exit?

Maybe something like Select Case?

Regards.




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
UserForm TextBox/ComboBox question grasping@straws Excel Discussion (Misc queries) 1 February 2nd 05 11:14 AM
Textbox in userform Harald Staff Excel Programming 0 September 8th 04 11:51 AM
combobox/textbox/userform/other question RPIJG[_49_] Excel Programming 1 June 16th 04 07:53 PM
Question about ComboBox/Userform/TextBox etc. RPIJG[_41_] Excel Programming 8 June 16th 04 03:41 PM
UserForm TextBox to ActiveSheet TextBox over 256 characters Dan E[_2_] Excel Programming 1 July 28th 03 07:36 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"