Macro for Multiple Sheet Print Areas

lbanham

Board Regular
Joined
Feb 17, 2011
Messages
50
Hi,
I need a macro to set the same print area over approx 50 sheets.
Sheet 1, has the print area I want to replicate.
The print area is A1:U190, the sheet needs to be printed on 1 page wide, by two pages tall. It must also page break at row 79.

The sheets are say named Sheet 1 to Sheet 50.

I am using excel 2007.

Any suggestions welcome.

Thanks :)
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
This should do it....

Code:
 Sub test()
Dim WorkSh As Worksheet
For Each WorkSh In ActiveWorkbook.Worksheets
    With WorkSh.PageSetup
        .PrintArea = "$A$1:$u$190"
        .CenterHorizontally = True
        .CenterVertically = True
        .Orientation = xlLandscape
        .PaperSize = xlPaperA4
        .FitToPagesWide = 1
        .FitToPagesTall = 2
        .Zoom = False
    End With
Next WorkSh
End Sub
 
Last edited:
Upvote 0
Thanks, that works brilliantly. Is it possible to include a specified page break? I need it to page break at row 79 so it prints in the correct sections.

Thanks again! :)
 
Upvote 0
Sorry to be a pain, but is it also possible to specify the range of sheets? I have several sheets at the end that shouldnt be formated in this way (i.e i only want to format sheets 1 to 50 and exclude 51-60 etc). I hid them before i ran it, but that didnt work.


Thanks very much

Lynsey
 
Upvote 0

Forum statistics

Threads
1,217,396
Messages
6,136,375
Members
450,006
Latest member
DaveLlew

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top