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: Repeating Rows on a Printout Except On the Last Page.

Repeating Rows on a Printout Except On the Last Page

by Allen Wyatt
(last updated April 25, 2016)

4

Nancy knows how to format a worksheet so that rows are repeated at the top of each page of a printout. What she wants to do, however, is to have the rows repeated at the top of each printed page except the last one.

There is no direct way to do this, but you can simulate such a printing by using a macro to do the task. All you need to do is have the macro print all except your last page, then change the page setup so that rows are not repeated, and finally print the final page of the printout. The following macro provides an example of this approach.

Sub PrintWorksheet()
    Dim lPages As Long
    Dim sTemp As String

    lPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
    With ActiveSheet.PageSetup
        ActiveSheet.PrintOut From:=1, To:=lPages - 1
        sTemp = .PrintTitleRows
        .PrintTitleRows = ""
        ActiveSheet.PrintOut From:=lPages, To:=lPages
        .PrintTitleRows = sTemp
    End With
End Sub

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3389) 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: Repeating Rows on a Printout Except On the Last Page.

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

Determining Business Quarters from Dates

Many businesses organize information according to calendar quarters, especially when it comes to fiscal information. Given a ...

Discover More

Inserting the Document Title in Your Document

One of the pieces of information you can store with a document is the title of that document. Using fields, you can then ...

Discover More

Adding Caption Labels

When using the captioning capabilities of Word, you aren't limited to the three default caption labels provided in the ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (menu)

Printing a Number of Different Pages

If you don't need to print an entire workbook, it can be confusing to figure out how to print just certain pages. This tip ...

Discover More

Printing an Entire Workbook by Default

Need to print an entire workbook? It's as easy as adding a single line of code to your macros.

Discover More

Specifying an Order for Page Printing

When the data on a worksheet occupies more than one printed page, Excel can easily determine where the first page of data is ...

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. 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 six less than 6?

2016-11-07 09:32:19

Luke Skaff

The problem with this approach is when you remove the repeating rows to print the last page it shifts all the data up as the repeating row is not longer taking up space. This causes the last past to be missing some of the rows from the spreadsheet.

What needs to be done is the code has to grab where the divider page break is for the last page printing, print the all pages but the last page, remove the repeating row, change the page break on the last page to the original position that it was before removing the repeating header row, then print the last page


2016-05-20 15:39:22

Kim

Hi,
This is not working for me. On the last page of the document, the title row is not present (Yay!), but the first couple of rows are missing.
Thanks


2015-03-17 03:03:01

Joey Liang

How about export it in PDF? I've tried for printout, it works well. But I need the same for exporting to PDF in excel 2013.


2011-11-02 15:51:01

Jim Miller

Thanks for posting this. It's exactly what I was looking for and great for a VB newbie.


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.