ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Print area composed by more range (https://www.excelbanter.com/excel-programming/383634-print-area-composed-more-range.html)

Andrea

Print area composed by more range
 
Hi all,
I know how to set a print area composed by two (or more) areas; i.e. I
select range A1:B2 and then (with CTRL pressed) select A10:B12, so my print
area is composed by two range.
How can I do this with a macro?
Thanks in advance
JFM



joel

Print area composed by more range
 
I always try to learn the macro and see what code excel produces. this
solves many of these type problems.

"Andrea" wrote:

Hi all,
I know how to set a print area composed by two (or more) areas; i.e. I
select range A1:B2 and then (with CTRL pressed) select A10:B12, so my print
area is composed by two range.
How can I do this with a macro?
Thanks in advance
JFM




Vergel Adriano

Print area composed by more range
 

Activesheet.PageSetup.PrintArea = "$A$1:$B$2,$A$10:$B$12"


"Andrea" wrote:

Hi all,
I know how to set a print area composed by two (or more) areas; i.e. I
select range A1:B2 and then (with CTRL pressed) select A10:B12, so my print
area is composed by two range.
How can I do this with a macro?
Thanks in advance
JFM




Tom Ogilvy

Print area composed by more range
 
I think Joel is trying to tell you that you can get this code by turning on
the macro recorder (tools=Macro=Record a new macro) then performing the
action manually. Then turn off the macro recorder and look at the code
recorded. In this case:

Sub Macro1()
Range("A1:D15,F19:J31").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$D$15,$F$19:$J$31"
End Sub


--
Regards,
Tom Ogilvy


"Andrea" wrote:

Hi all,
I know how to set a print area composed by two (or more) areas; i.e. I
select range A1:B2 and then (with CTRL pressed) select A10:B12, so my print
area is composed by two range.
How can I do this with a macro?
Thanks in advance
JFM





All times are GMT +1. The time now is 04:13 AM.

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