G
Guest
Here is my challenge… Someone helped me right the following code
that automatically selects the number of pages to print. But...
I would like to use a check box in the workbook to put a “True†or “Falseâ€
in a cell, for example “S1†that would disable the above code. End goal:
Some users could ignore the check box and the worksheet would print as many
pages as are indicated in “S2†and the more advanced users could check the
box, thus returning the print parameters to them… enabling them to select any
combination of pages to print.
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim rng As Range
Set rng = ActiveSheet.Range("S2")
On Error GoTo XIT
Application.EnableEvents = False
Cancel = True
ActiveSheet.PrintOut from:=1, to:=rng.Value
XIT:
Application.EnableEvents = True
End Sub
Any ideas? Thanks for your time....
that automatically selects the number of pages to print. But...
I would like to use a check box in the workbook to put a “True†or “Falseâ€
in a cell, for example “S1†that would disable the above code. End goal:
Some users could ignore the check box and the worksheet would print as many
pages as are indicated in “S2†and the more advanced users could check the
box, thus returning the print parameters to them… enabling them to select any
combination of pages to print.
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim rng As Range
Set rng = ActiveSheet.Range("S2")
On Error GoTo XIT
Application.EnableEvents = False
Cancel = True
ActiveSheet.PrintOut from:=1, to:=rng.Value
XIT:
Application.EnableEvents = True
End Sub
Any ideas? Thanks for your time....