Trying to delete a range if the user prints a particular sheet, however I do NOT want to delete the range if the print preview is clicked...
1-The above code gives a Method Range of oject _worksheet failed when trying to clear the range, how can I correct this ?
2- How can I NOT clear the Range if the user clicks print Preview from sheet6 ?
Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.CodeName = "Sheet6" Then
Application.EnableEvents = False
Cancel = True
Sheet6.PrintOut
Sheet6.Range("A1:I1,B2,B3,H2,H3,B12:H28,H30,H32,H33,H35").ClearContents
Application.EnableEvents = True
end if
End Sub
2- How can I NOT clear the Range if the user clicks print Preview from sheet6 ?