Hey there,
I am new to writing vba code and came across this problem. Seems pretty simple but I can't seem to get it to work. I am looking for the below code to work only on sheet1 of the workbook. Please help??
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If Range("B3") = 0 Then
Cancel = True
Msgbox "Please fill out Date", vbInformation, "DSR_Autochecker"
ElseIf Range("S3") = 0 Then
Cancel = True
Msgbox "Please fill out Store #", vbInformation, "DSR_Autochecker"
ElseIf Range("K22") = 0 Then
Cancel = True
Msgbox "Please fill out Deposit Bag Number", vbInformation, "DSR_Autochecker"
ElseIf Range("R40") = 0 Then
Cancel = True
Msgbox "Please fill out Preparer Name", vbInformation, "DSR_Autochecker"
ElseIf Range("R41") = 0 Then
Cancel = True
Msgbox "Please fill out Witness Name", vbInformation, "DSR_Autochecker"
End If
End Sub
Bookmarks