Sub topic 7
Repeating Header Rows and Columns on Every Page
This chapter assumes you can use the Page Layout tab, select ranges, and read Page Break Preview from earlier chapters. You should also know how a print area limits what prints.
Why print titles matter
A table that fits on one screen often runs to several printed pages. Pages two and beyond then show numbers with no column labels. Readers have to flip back to page one to learn what each column means.
Excel solves this with print titles. These are rows or columns that Excel repeats at the top or left of every printed page. The data on the sheet does not change. Only the printed output and the PDF export are affected.
Setting title rows
- Open the Page Layout tab.
- In the Page Setup group, choose Print Titles. The Page Setup dialog opens on the Sheet tab.
- Click in Rows to repeat at top.
- On the sheet, click a cell in the header row, or drag across several header rows.
- Choose OK.
Excel fills the box with an absolute reference such as $1:$1. A two-row header appears as $1:$2. You can also type the reference.
Title rows must be contiguous. You can't repeat rows 1 and 5 without repeating everything between them.
Setting title columns
Use Columns to repeat at left for wide tables. If a report has an ID or name in column A and many month columns, repeating column A keeps each row identifiable on pages that print further to the right.
The reference looks like $A:$A. You can combine rows and columns in the same dialog.
How repeating works
Excel repeats titles only on pages that come after the title rows or columns first appear. If your header is in row 1, page one prints it normally and pages after it repeat it.
Titles repeat only on pages within the print area. If your print area starts at row 10, you can still set row 1 as a title row. Excel then prints row 1 above the data on every page, including the first one.
Page breaks still decide where pages split. The titles use up space on each page. A tall header leaves fewer data rows per page, so the page count can increase.
Setting titles with VBA
The same setting is available in the PageSetup object. This line repeats row 1, as in the macro from the automation chapter:
Sub RepeatHeader()
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = "$A:$A"
End With
End SubTo remove titles, set either property to an empty string, "".
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| The Print Titles button is greyed out | You are editing a cell, or a chart is selected | Press Esc, then select a cell |
| Headers appear only on page one | Titles were set on another sheet | Titles are saved per sheet, so set them on each sheet |
| Wrong row repeats | The reference was typed on a sheet where rows were later inserted | Reopen the dialog and check the reference |
| Column titles repeat but the first page looks doubled | Title columns overlap the print area | Check that the title range and print area are distinct |
| Header repeats on a page with no data | A manual page break creates a nearly empty page | Remove the break in Page Break Preview |
Checking the result
Open Print Preview and step through the pages. Look at the top of page two and any page to the right of page one. Use Page Layout view to see the same pages while you edit.
Exercise
A sales table has its headers in rows 3 and 4, and customer names in column B. The data fills 200 rows and 14 columns. What would you enter in Rows to repeat at top and Columns to repeat at left so each printed page shows the headers and customer names?
Show answer
Enter $3:$4 in Rows to repeat at top and $B:$B in Columns to repeat at left. Rows must be contiguous, so the range covers rows 3 and 4. Then check Print Preview on pages two and later.