mardi 4 avril 2017

Excel Combo box conditional If statement to detect blank

I am writing an If statement to test if I i have an option selected in two combo boxes. The combo box being checked is generated from another worksheet with 3 cells. One of those cells are blank so the top value is blank in the combo box.

My if statement is

 Private Sub cbApplicationSelection_Change()
   If (eMassWelcome.cbwesitechoose.text = "") Then
   eMassWelcome.cbApplicationSelection.text = ""
   MsgBox "A website has not been selected. Please select a website from the dropdown and try again."
   End If
   Exit Sub
 End Sub

This works.

The problem is the pop up comes up 3 times and im not sure why. I've tried IsNull() and listindex = -1. IsNull() did not work and list index gave me the same result as above. All this is being done with vba in excel.

Aucun commentaire:

Enregistrer un commentaire