pagesetup all sheets

bak

New Member
Joined
Mar 3, 2011
Messages
26
How can I set al pagesetups to: wide 1 and tall 1
In al sheets in combinations with:

Dim Rng As String
Dim Wks As Worksheet
Rng = "$AF$2:$AU$66,$AW$2:$BG$42"
For Each Wks In Worksheets
Wks.PageSetup.PrintArea = Rng
Next Wks
ActiveWorkbook.PrintOut Copies:=1, Collate:=True
End Sub
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Try:

Code:
For Each Wks In Worksheets
    With Wks.PageSetup
        .PrintArea = Rng
        .Zoom = False
        .FitToPagesWide = 1
        .FitToPagesTall = 1
    End With
Next Wks
 
Upvote 0
Try this as a manual option. Create the page settings on your first sheet, then group the other sheets (including the first), select the pagesetup option and then click OK it should apply all the settings you added from the first sheet to the others you have grouped.

If you dont want to do that manual try this

Sub SheetsSetup()
For Each Ws In Worksheets
With Ws.PageSetup
.PrintArea = Rng
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Next Ws
End Sub
 
Upvote 0
Oke thanks for the fast reaction:D

One little other question. What if I want to fit on one page? replace the 1 for....?
 
Upvote 0
There is now one page that has empty space on the page. Maybe zoom that page?
 
Upvote 0
Fit to page doesn't increase the zoom above 100%. You will have to do that manually. If you record a macro while doing it you will get some VBA code.
 
Upvote 0

Forum statistics

Threads
1,214,566
Messages
6,120,266
Members
448,953
Latest member
Dutchie_1

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