Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Resetting Page Setup.

Resetting Page Setup

by Allen Wyatt
(last updated May 17, 2014)

1

Lori wrote concerning a problem she was having with Excel. It seemed that the page setup for every worksheet in every workbook had changed. Worksheets that previously printed on a single page no longer fit on one page, instead printing on two.

The most likely explanations for behavior such as this is that something has changed in relation to how you print your worksheets. I don't mean that you have gone in and changed your page setup—I mean that you have physically changed a printer on your system or that the printer driver used by your system has been changed. Making such changes can universally affect your worksheets.

It is also possible that the change is due to a change in your version of Excel. If you recently upgraded to a different version, then worksheets could be rendered differently by Excel than they used to be.

Unfortunately, the only way to solve this issue—regardless of the cause—is to manually go through each workbook and change the page setup information for each worksheet. It is time consuming, but the only solution available.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2578) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Resetting Page Setup.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Converting Numbers to Text

Got some numbers you need spelled out? Here's a handy macro that can convert numbers like "123" to words like "one ...

Discover More

Setting the Starting Line Number

Line numbers are an important part of some documents, such as those prepared in the legal profession. If you want to ...

Discover More

Displaying a Result as Minutes and Seconds

When you use a formula to come up with a result that you want displayed as a time, it can be tricky figuring out how to ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (menu)

Changing Page Margins

If your worksheet is destined to be printed, you'll need to be concerned with how it appears on the page. One layout ...

Discover More

Setting Page Margins

When getting ready to print your worksheet, you may want to take a moment to check what margins Excel will use on the ...

Discover More

Setting Default Print Margins

Don't like the print margins that Excel uses by default? You can change the default by changing the workbook on which ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is three minus 3?

2014-05-17 08:19:02

David Ruben

Of course if frequently take the spreadsheet between different computers or share between people, or as in my case adding or deleting rows destroys carefully crafted page splits along alphabetical entry in column A... then a macro can reset page breaks and the PrintArea; this is triggered by the Workbook_BeforePrint event. The following has constants to set PrintArea end column (presumes starts from column "A", and in example to column "H"), number of title rows at the top (e.g. 5), and the number of rows that will generally always fit depending on font a& fontsize (46 in this example with no enlarged top header text)

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Const iPageRows As Integer = 46
Const iTitleRows As Integer = 5
Const sEndColumn As String = "H"
Dim iBodyRows As Integer, iTopRow As Integer, iRow As Integer
On Error GoTo L_Quit

'Body of text is iPageLength less the iTitleRows rows
iBodyRows = iPageRows - iTitleRows
'Temporarily turn off screen updating
Application.ScreenUpdating = False
'Clear old pagebreaks
ActiveSheet.ResetAllPageBreaks

'Start with row after the header
iRow = iTitleRows + 1

L_TopPage:
'Set Top of current page row
iTopRow = iRow

L_Loop:
'Work through rows to add page breaks
iRow = iRow + 1

'check if reached end of table of data
If Range("A" & iRow) = "" Then GoTo L_Completed

'Pagebreak if new alphabet letter in column A or maximum lines per page
If UCase(Left(Range("A" & iRow), 1)) <> UCase(Left(Range("A" & iRow - 1), 1)) _
Or iRow - iTopRow > iBodyRows Then _
Rows(iRow & ":" & iRow).Select: _
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell: _
GoTo L_TopPage

GoTo L_Loop

L_Completed:
'Set the PrintArea and Title rows
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$" & iTitleRows
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = "$A$1:$" & sEndColumn & "$" & (iRow - 1)

L_Quit:
Application.ScreenUpdating = True
End Sub


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.