Do not print Workbook if Cells or ComboBox1 is Null

0

I am trying to make sure all of my fields are not left blank before printing.  In the example code, the range Values stop the printing but the Elseif statement for the  ComboBox1 is not working.  Would someone please help me?

Private Sub Workbook_BeforePrint(Cancel As Boolean)
'Check to see if Cells are blank
    If Range("H7").Value = "" Then
        Cancel = True
        MsgBox "The Event Date can not be blank"
        
    ElseIf Range("D9").Value = "" Then
        Cancel = True
        MsgBox "Your Name can not be blank"
    
    ElseIf Range("D11").Value = "" Then
        Cancel = True
        MsgBox "Event Name can not be blank"
        
    ElseIf Range("D13").Value = "" Then
        Cancel = True
        MsgBox "Brand can not be blank"
        
    ElseIf Range("I13").Value = "" Then
        Cancel = True
        MsgBox "Covered by Supplier can not be blank"
        
    ElseIf Range("D15").Value = "" Then
        Cancel = True
        MsgBox "Bill Back Contant can not be blank"
    ElseIf Sheet1(ActionPlan.ComboBox1.ListIndex) = -1 Then
        Cancel = True
        MsgBox "Bill Back Contant can not be blank"
        
    End If
End Sub
Post Edited
CODE Tags: You must add [CODE][/CODE] tags around your code! (click the CODE button to do this when creating a post)
Answer
Discuss

Discussion

Please put CODE tags around your code. To do that, edit your post, select your code and click the CODE button.
don (rep: 1492) Aug 24, '16 at 7:56 pm
Add to Discussion

Answers

0

Try

ActionPlan.ComboBox1.ListIndex = vbNullString
Discuss
0
ElseIf ActiveSheet.ComboBox1.Value = "" Then
Discuss

Answer the Question

You must create an account to use the forum. Create an Account or Login