The code used to work & now it has just stopped, not sure what happened. I have a button on the sheet that prints 4 copies. The sheet is a invoice and at the bottom the user is supposed to enter page 1 of 1 .
Listed below are two codes first is the one that i use, & the second is one i just tried that doesn't work either. The code is in This Workbook / Before Print. I'm running 2016...I did read where before print doesn't work with 2013 & later..?
Listed below are two codes first is the one that i use, & the second is one i just tried that doesn't work either. The code is in This Workbook / Before Print. I'm running 2016...I did read where before print doesn't work with 2013 & later..?
VBA Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Blank 195" Then
If Sheets("Blank 195").Range("A38").Value = "" Then
If Sheets("Blank 195").Range("C38").Value = "" Then
MsgBox "More info needed Please select Page 1 of 1 ", vbCritical
Cancel = True
End If
End If
End Sub
VBA Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Blank 195" Then
Dim jRange As Range
Set jRange = Sheets("Template").Range("A38,C38")
Dim ReqFields As Boolean
For Each cell In jRange
If cell.Value = "" Then
ReqFields = True
End If
Next
If ReqFields Then
MsgBox ("Cannot leave Page 1 of 1 Blank, More info needed Please select Page 1 of 1"), vbCritical
Cancel = True
End If
End If
End Sub