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

Rounding to the Nearest $50

When preparing financial reports, it may make your data easier to understand if you round it to the nearest multiple, such as ...

Discover More

Retrieving the Last Value in a Column

Need to get at the last value in a column, regardless of how many cells are used within that column? You can apply the ...

Discover More

Creating Page Footers and Headers

Headers and footers can add a final, professional touch to your printed document. Here's the quick way to add the headers and ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

MORE EXCELTIPS (MENU)

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 Excel ...

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

Scaling Your Printing

If you want to cram more of your worksheet onto each page of a printout, one way to do it is by using scaling. Here's how you ...

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 for this tip:

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. 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 nine more than 2?

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


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.

Links and Sharing
Share