Block Printing of sheet

S

Shu of AZ

I have two worksheets, sheet1 and sheet2. Is there code to block sheet1 from
printing without having to place the print area in some distant cell and
protect the sheet.
 
M

Mike H

Hi,

Alt + F11 to open VB editor. Double Click 'This Workbook' and paste this in
on the right

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = ("Sheet1") Then
MsgBox "You cannot print this sheet"
Cancel = True
End If
End Sub

Mike
 
Top