ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel - I want to predefine more than one print area option - how (https://www.excelbanter.com/excel-discussion-misc-queries/124737-excel-i-want-predefine-more-than-one-print-area-option-how.html)

zip82dah

Excel - I want to predefine more than one print area option - how
 
I am working with new Excel users. I have a worksheet that sometimes needs
one print range and sometimes another. How can I predefine those ranges so
the users can just select PrintArea1 or PrintArea2?

Don Guillett

Excel - I want to predefine more than one print area option - how
 
Lots of ways. A cell with 1 or 2 and a macro or an input box in the macro

--
Don Guillett
SalesAid Software

"zip82dah" wrote in message
...
I am working with new Excel users. I have a worksheet that sometimes needs
one print range and sometimes another. How can I predefine those ranges
so
the users can just select PrintArea1 or PrintArea2?




Mike

Excel - I want to predefine more than one print area option - how
 
probably best done with a macros such as

ActiveSheet.PageSetup.PrintArea = "$E$14:$J$23"

You could put a button on the worksheet to call the macro for the different
print areas

"zip82dah" wrote:

I am working with new Excel users. I have a worksheet that sometimes needs
one print range and sometimes another. How can I predefine those ranges so
the users can just select PrintArea1 or PrintArea2?


Gord Dibben

Excel - I want to predefine more than one print area option - how
 
You can use ViewCustom Views to set up two different print ranges for your
users to pick from.

Or you could use a macro to print a selected range

You can use the name of the custom view as a parameter in your macro or just
direcly name the range to print.

I prefer the custom views method because you can hide rows and columns within
one print range.


Gord Dibben MS Excel MVP

On Thu, 4 Jan 2007 11:36:01 -0800, zip82dah
wrote:

I am working with new Excel users. I have a worksheet that sometimes needs
one print range and sometimes another. How can I predefine those ranges so
the users can just select PrintArea1 or PrintArea2?



Rookie 1st class

Excel - I want to predefine more than one print area option -
 
The code below automatically sets the print area (1 to 7 pages) based on 1
cell in each page being populated. You must start at the last page and work
back (the first page is always populated). Page 1 is not always required, the
first if statement determines whether to print page 1 or not. A separate
macro hides page 1 if not required.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
'Set Sheets to Print
Application.ScreenUpdating = False
If Range("InstrmntTP7") < "" Then
If Range("StndrdTP1") < "" Then
ActiveSheet.PageSetup.PrintArea = "Pg1:Pg7"
Else
ActiveSheet.PageSetup.PrintArea = "Pg2:Pg7"
End If
ElseIf Range("InstrmntTP6") < "" Then
If Range("StndrdTP1") < "" Then
ActiveSheet.PageSetup.PrintArea = "Pg1:Pg6"
Else
ActiveSheet.PageSetup.PrintArea = "Pg2:Pg6"
End If
ElseIf Range("InstrmntTP5") < "" Then
If Range("StndrdTP1") < "" Then
ActiveSheet.PageSetup.PrintArea = "Pg1:Pg5"
Else
ActiveSheet.PageSetup.PrintArea = "Pg2:Pg5"
End If
ElseIf Range("InstrmntTP4") < "" Then
If Range("StndrdTP1") < "" Then
ActiveSheet.PageSetup.PrintArea = "Pg1:Pg4"
Else
ActiveSheet.PageSetup.PrintArea = "Pg2:Pg4"
End If
ElseIf Range("InstrmntTP3") < "" Then
If Range("StndrdTP1") < "" Then
ActiveSheet.PageSetup.PrintArea = "Pg1:Pg3"
Else
ActiveSheet.PageSetup.PrintArea = "Pg2:Pg3"
End If
ElseIf Range("InstrmntTP2") < "" Then
If Range("StndrdTP1") < "" Then
ActiveSheet.PageSetup.PrintArea = "Pg1:Pg2"
Else
ActiveSheet.PageSetup.PrintArea = "Pg2"
End If
ElseIf Range("StndrdTP1") < "" Then
ActiveSheet.PageSetup.PrintArea = "Pg1"
Else: Cancel = True
End If
Application.ScreenUpdating = True
End Sub

I think you can easily adapt this to meet your needs.
Lou


"Gord Dibben" wrote:

You can use ViewCustom Views to set up two different print ranges for your
users to pick from.

Or you could use a macro to print a selected range

You can use the name of the custom view as a parameter in your macro or just
direcly name the range to print.

I prefer the custom views method because you can hide rows and columns within
one print range.


Gord Dibben MS Excel MVP

On Thu, 4 Jan 2007 11:36:01 -0800, zip82dah
wrote:

I am working with new Excel users. I have a worksheet that sometimes needs
one print range and sometimes another. How can I predefine those ranges so
the users can just select PrintArea1 or PrintArea2?




Rookie 1st class

Excel - I want to predefine more than one print area option -
 
I overlooked something that may cause you fits. Pg1 is a named range
(A14:AU57). As are all pages (named).
An equivalent formula to "ActiveSheet.PageSetup.PrintArea = "Pg1:Pg7"" is
ActiveSheet.PageSetup.PrintArea = "A1:AU327"
Lou

"Rookie 1st class" wrote:

The code below automatically sets the print area (1 to 7 pages) based on 1
cell in each page being populated. You must start at the last page and work
back (the first page is always populated). Page 1 is not always required, the
first if statement determines whether to print page 1 or not. A separate
macro hides page 1 if not required.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
'Set Sheets to Print
Application.ScreenUpdating = False
If Range("InstrmntTP7") < "" Then
If Range("StndrdTP1") < "" Then
ActiveSheet.PageSetup.PrintArea = "Pg1:Pg7"
Else
ActiveSheet.PageSetup.PrintArea = "Pg2:Pg7"
End If
ElseIf Range("InstrmntTP6") < "" Then
If Range("StndrdTP1") < "" Then
ActiveSheet.PageSetup.PrintArea = "Pg1:Pg6"
Else
ActiveSheet.PageSetup.PrintArea = "Pg2:Pg6"
End If
ElseIf Range("InstrmntTP5") < "" Then
If Range("StndrdTP1") < "" Then
ActiveSheet.PageSetup.PrintArea = "Pg1:Pg5"
Else
ActiveSheet.PageSetup.PrintArea = "Pg2:Pg5"
End If
ElseIf Range("InstrmntTP4") < "" Then
If Range("StndrdTP1") < "" Then
ActiveSheet.PageSetup.PrintArea = "Pg1:Pg4"
Else
ActiveSheet.PageSetup.PrintArea = "Pg2:Pg4"
End If
ElseIf Range("InstrmntTP3") < "" Then
If Range("StndrdTP1") < "" Then
ActiveSheet.PageSetup.PrintArea = "Pg1:Pg3"
Else
ActiveSheet.PageSetup.PrintArea = "Pg2:Pg3"
End If
ElseIf Range("InstrmntTP2") < "" Then
If Range("StndrdTP1") < "" Then
ActiveSheet.PageSetup.PrintArea = "Pg1:Pg2"
Else
ActiveSheet.PageSetup.PrintArea = "Pg2"
End If
ElseIf Range("StndrdTP1") < "" Then
ActiveSheet.PageSetup.PrintArea = "Pg1"
Else: Cancel = True
End If
Application.ScreenUpdating = True
End Sub

I think you can easily adapt this to meet your needs.
Lou


"Gord Dibben" wrote:

You can use ViewCustom Views to set up two different print ranges for your
users to pick from.

Or you could use a macro to print a selected range

You can use the name of the custom view as a parameter in your macro or just
direcly name the range to print.

I prefer the custom views method because you can hide rows and columns within
one print range.


Gord Dibben MS Excel MVP

On Thu, 4 Jan 2007 11:36:01 -0800, zip82dah
wrote:

I am working with new Excel users. I have a worksheet that sometimes needs
one print range and sometimes another. How can I predefine those ranges so
the users can just select PrintArea1 or PrintArea2?





All times are GMT +1. The time now is 12:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com