I am trying to see if a range of cells has the word "shipping" before closing and i keep getting an error. below is what i have. can anyone help me out?
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If WorksheetFunction.CountIf(Sheet2.Range("d2:d17") <> "shipping") Then
Cancel = False
MsgBox "Did you charge for shipping?"
End If
If Sheet6.Range("h1") = 2 And Sheet6.Range("f7") = "" Then
Cancel = True
MsgBox "You must enter an invoice date and a PO#."
End If
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If WorksheetFunction.CountIf(Sheet2.Range("d2:d17") <> "shipping") Then
Cancel = False
MsgBox "Did you charge for shipping?"
End If
If Sheet6.Range("h1") = 2 And Sheet6.Range("f7") = "" Then
Cancel = True
MsgBox "You must enter an invoice date and a PO#."
End If
End Sub