Macro for modifying Page Setup - only part of it works

jrnyman

Board Regular
Joined
Mar 10, 2002
Messages
105
I've written this loop to modify the page setup for each page I need to print. When i step through it, it does indeed go to each page, but when it's done and I manually check the settings, the FitToPages...settings never stick. The footer is fine, but I can't tell it to print each page on ONE page. Anyone think they can help? I got the code from a recorded macro.

For ContentCtr = 3 To (SheetCounter + 1) 'SheetCounter is defined earlier as thhe number of sheets I'm interested in
Sheets(ContentCtr).Select
ActiveSheet.PageSetup.PrintArea = ""
ActiveSheet.PageSetup.FitToPagesWide = 1
ActiveSheet.PageSetup.FitToPagesTall = 1
ShtNum = ContentCtr
Sheets(ContentCtr).PageSetup.RightFooter = "Page " & ShtNum
Next ContentCtr
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
You need to set the .Zoom to False.

ActiveSheet.PageSetup.Zoom = False

The recorded macro should have done that for you. I realize many of those recorded lines are extraneous, but that one is necessary.

Bill

_________________
MrExcel.com Consulting
This message was edited by MrExcel on 2002-04-11 07:57
 
Upvote 0
Perfect.

I don't know where you pick up these things, but that certainly did the trick. Thanks.

JrnyMan
Youngstown, Ohio
(presently in London)
 
Upvote 0

Forum statistics

Threads
1,213,544
Messages
6,114,249
Members
448,556
Latest member
peterhess2002

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