This works for me.
Private Sub CommandButton1_Click()
Dim Ctrl As Control
For Each Ctrl In Controls
Ctrl.Tag = "REQUIRED"
Next Ctrl
For Each Ctrl In Controls
If Ctrl.Tag = "REQUIRED" Then
Select Case TypeName(Ctrl)
Case "ListBox"
If Ctrl.ListIndex = -1 Then _
Debug.Print Ctrl.Name, "is empty."
Case "ComboBox"
If Ctrl.Value = "" Then _
Debug.Print Ctrl.Name, "is empty."
Case Else
End Select
End If
Next Ctrl
End Sub
TIP: Paste code between code tags for structure and required by forum rules. Click the # icon on the reply toolbar to insert tags.
Bookmarks