View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chris Chris is offline
external usenet poster
 
Posts: 244
Default Users leaving blanks

Im assuming this is for the click event of the OK butto
try something like this

Private Sub btnOk_Click(
Dim txtbx As MSForms.TextBo
For Each ctrl In Me.Control
If TypeOf ctrl Is MSForms.TextBox The
Set txtbx = ctr
If txtbx.value = "" then
msgbox "Please ensure all the boxes are filled before clicking OK
txtbx.setfocu
Exit Su
End i
End I
Nex
'put your proceed if everything is ok code her

End Su


----- Yvonne Wilder wrote: ----

I have a user input form and I am trying to stop users
leaving the fields empty. I am using the following code

If txtname.Value Is Null Then MsgBox "Please ensure all
the boxes are filled before clicking OK" End Su

Where am I going wrong

Yvonn