ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Looping a textbox (https://www.excelbanter.com/excel-programming/408439-looping-textbox.html)

LRay67

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

FSt1

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


joel

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



All times are GMT +1. The time now is 12:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com