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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Try:

Code:
For Each Wks In Worksheets
    With Wks.PageSetup
        .PrintArea = Rng
        .Zoom = False
        .FitToPagesWide = 1
        .FitToPagesTall = 1
    End With
Next Wks
 
Upvote 0

Trevor G

Well-known Member
Joined
Jul 17, 2008
Messages
6,708
Office Version
  1. 2016
Platform
  1. Windows
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

bak

New Member
Joined
Mar 3, 2011
Messages
26
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

bak

New Member
Joined
Mar 3, 2011
Messages
26
There is now one page that has empty space on the page. Maybe zoom that page?
 
Upvote 0

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
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,191,031
Messages
5,984,235
Members
439,879
Latest member
KingGoulash

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
Top