Good morning,
I have a UserForm with Combo Boxes, List Boxes, Text Boxes etc. When the OK button is clicked I want it to ensure certain fields are not left blank and notify the user (see code below). This works great for the combo boxes but not for list boxes. It seems to skip over that code. In other words, in the code below, if a manager is not selected, it doesn't notify the user. Any help is greatly appreciated.
Private Sub OkButton_Click()
'Verify fields are not left blank
If cboAgent.Value = "" Then
MsgBox ("Please select an Agent")
cboAgent.SetFocus
Exit Sub
End If
If cboLead.Value = "" Then
MsgBox "Please select a Team Lead"
cboLead.SetFocus
Exit Sub
End If
If ManagerListBox.Value = "" Then
MsgBox "Please select a Manager"
ManagerListBox.SetFocus
Exit Sub
End If
I have a UserForm with Combo Boxes, List Boxes, Text Boxes etc. When the OK button is clicked I want it to ensure certain fields are not left blank and notify the user (see code below). This works great for the combo boxes but not for list boxes. It seems to skip over that code. In other words, in the code below, if a manager is not selected, it doesn't notify the user. Any help is greatly appreciated.
Private Sub OkButton_Click()
'Verify fields are not left blank
If cboAgent.Value = "" Then
MsgBox ("Please select an Agent")
cboAgent.SetFocus
Exit Sub
End If
If cboLead.Value = "" Then
MsgBox "Please select a Team Lead"
cboLead.SetFocus
Exit Sub
End If
If ManagerListBox.Value = "" Then
MsgBox "Please select a Manager"
ManagerListBox.SetFocus
Exit Sub
End If