Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Looping a textbox

I need to create a loop that doesn't allow the user to leave the textbox
until it is filled. Below is what I have coded for the message box but would
like to include the loop until textbox is filled. Also if possible would
like this field to be visited without the LostFocus aspect of it. Any
Suggestions?

Private Sub Textbox8_LostFocus()
If TextBox8 = "" Then
MsgBox "Please enter Submitting Agency Name"
Exit Sub
End If
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Looping a textbox

hi
you don't really need a loop for this. just prevent the user from leaving
the text box.
add this line to your code just just after your message box and before the
exit sub commmand.

Textbox8.activate

this will put the curser back into the text box.

regards
FSt1

"LRay67" wrote:

I need to create a loop that doesn't allow the user to leave the textbox
until it is filled. Below is what I have coded for the message box but would
like to include the loop until textbox is filled. Also if possible would
like this field to be visited without the LostFocus aspect of it. Any
Suggestions?

Private Sub Textbox8_LostFocus()
If TextBox8 = "" Then
MsgBox "Please enter Submitting Agency Name"
Exit Sub
End If
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Looping a textbox

Private Sub Textbox8_LostFocus()
do while TextBox8 = ""
response = inputBox "Please enter Submitting Agency Name: "
TexBox8 = response
loop
End Sub

"LRay67" wrote:

I need to create a loop that doesn't allow the user to leave the textbox
until it is filled. Below is what I have coded for the message box but would
like to include the loop until textbox is filled. Also if possible would
like this field to be visited without the LostFocus aspect of it. Any
Suggestions?

Private Sub Textbox8_LostFocus()
If TextBox8 = "" Then
MsgBox "Please enter Submitting Agency Name"
Exit Sub
End If
End Sub

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
Add Text to Textbox value by looping through a data range. Francis Brown Excel Programming 5 October 6th 05 12:16 AM
Add Text to Textbox value by looping data Francis Brown Excel Programming 1 October 6th 05 12:06 AM
HELP! I Lost The Ability To Advance From TextBox To TextBox With the ENTER Or The TAB Keys Minitman[_4_] Excel Programming 0 February 22nd 05 08:50 PM
Textbox Bug? Missing/delayed update of textbox filled via VBA MarcM Excel Programming 0 November 4th 04 05:47 PM
Textbox Bug? Missing/delayed update of textbox filled via VBA MarcM Excel Programming 0 November 4th 04 05:43 PM


All times are GMT +1. The time now is 11:13 AM.

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

About Us

"It's about Microsoft Excel"