I am trying to set the print area based on the value of a cell on the ActiveSheet. This seemed fairly straight forward, but it still wants to print the entire Worksheet. I am using Excell 2007. Thanks for any help.
You don't know what you don't know...
Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Cancel = True
Application.EnableEvents = False
If Worksheets("CSP565").Range("R13").Value = 1 Then
ActiveSheet.PageSetup.PrintArea = "$A$1:$O$35"
Else: ActiveSheet.PageSetup.PrintArea = "$A$1:$O$69"
End If
Application.EnableEvents = True
End Sub
You don't know what you don't know...