View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Zani Zani is offline
external usenet poster
 
Posts: 29
Default UserForms, mandatory completion of fields

Many thanks for all your help, I am well on my way now!
--
Zani
(if I have posted here, I really am stuck!)



"Myles" wrote:


Zani, try:

Private Sub CommandButton1_Click()
Dim ctl As Control

For Each ctl In Me.Controls
If TypeName(ctl) = "TextBox" Then
If Len(ctl.Text) = 0 Then
MsgBox "please complete all mandatory fields"
Exit Sub
End If
End If
Next
Unload UserForm1
UserForm2.Show

End Sub

myles


--
Myles
------------------------------------------------------------------------
Myles's Profile: http://www.excelforum.com/member.php...o&userid=28746
View this thread: http://www.excelforum.com/showthread...hreadid=500988