Thread: Warning Message
View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Susan Susan is offline
external usenet poster
 
Posts: 1,117
Default Warning Message

since it's in a button_click event, just put

If TextBox3.Text or TextBox4.Text = "" Then

exit sub

your userform will still be there, and they can always click the
button again. you might want to add a message box before "exit sub"
that says

msgbox "there must be a value entered into........" , vbokonly

(whatever you've called that textbox.)

hope that helps
susan



On Jun 11, 3:09*pm, Ewing25 wrote:
Ok i adapted ur code a little to look like this im just not sure what to put
to keep the macro from executing. I put stop but i dont think its valid.

If TextBox3.Text = "" Then
* * *UserForm4.Show
* * *If TextBox3.Text = "" Then
* * * * *Unload UserForm4
If TextBox3.Text or TextBox4.Text = "" Then
* * * * * *Stop

* * * * End If
* * *End If
End If



"JLGWhiz" wrote:
It is a little difficult to do this efficiently, without knowing what
UserForm4 is doing, but I will try to give you an idea of how to approach it.


RETRY:
If TextBox3.Text = "" Then
* * *UserForm4.Show
* * *If TextBox3.Text = "" Then
* * * * *GoTo RETRY:
* * *End If
End If


The above code sets up a conditional loop using the label RETRY: *If after
UserForm4 has executed and closed the TextBox is still empty, then it will
loop until something is entered into the TextBox.


"Ewing25" wrote:


Ah sorry In the coe i have textbox3 and textbox4 display userform4 if they
are blank. Userform4 is just a userform i made to tell them to fill in the
fields. And yes that was my message box i described in the original text.