View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Myles[_34_] Myles[_34_] is offline
external usenet poster
 
Posts: 1
Default UserForms, mandatory completion of fields


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