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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
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
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,224,592
Messages
6,179,789
Members
452,942
Latest member
VijayNewtoExcel

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