Sub topic 7
Repeating Header Rows and Columns on Every Page
This chapter assumes you can set a print area, choose orientation and scaling, and read Page Break Preview. Those topics come from the earlier chapters. Here you will make column headings and row labels repeat on every printed page, so that page 7 of a report is as readable as page 1.
Why print titles exist
A worksheet with 400 rows prints across many pages. Excel puts the header row, such as Date | Region | Product | Amount, only on the first page. Pages 2 and onward show unlabeled numbers. The reader has to flip back to page 1 to know what each column means.
Excel calls the fix print titles. A print title is a row or column range that Excel prints at the top or left of every page, in addition to the content that belongs on that page. The same idea covers two cases:
- Rows to repeat at top repeat across the top of each page when a sheet runs over several pages tall.
- Columns to repeat at left repeat down the left side of each page when a sheet runs over several pages wide.
Print titles affect only printing, Print Preview, and PDF export. They do not change the worksheet on screen, and they do not freeze panes. Freeze Panes is a separate screen feature. Many people confuse the two because both keep a header visible.
Setting rows to repeat at top
- Open the Page Layout tab.
- In the Page Setup group, choose Print Titles. This opens the Page Setup dialog on the Sheet tab.
- Click in the Rows to repeat at top box.
- Click the row header (the row number) of the header row on the worksheet. Excel fills the box with an absolute reference such as
$1:$1. - Choose Print Preview to confirm, then OK.
To repeat more than one row, drag across several row numbers. A title block with a report name in row 1, a subtitle in row 2, and column headings in row 4 can be repeated as $1:$4. Rows 3 would repeat as well, which is usually a blank spacer. Repeat only contiguous rows. Excel cannot repeat rows 1 and 4 while skipping rows 2 and 3.
The references are absolute ($1:$4). If you insert a row above the range, Excel adjusts the reference. If you delete a row inside it, the range shrinks.
Setting columns to repeat at left
Use this when a wide table prints across several pages and the first column identifies each row, such as an employee name or a product code.
- In the Sheet tab of the Page Setup dialog, click in Columns to repeat at left.
- Click the column header letter of the identifying column. Excel enters a reference such as
$A:$A. - For several columns, drag across the letters, giving
$A:$B.
You can set both boxes at once. Then the top-left corner of the table, the cell where the repeated rows and repeated columns meet, appears on every page, and the row and column labels frame the data on each page.
How Excel decides when titles appear
Several rules explain behavior that surprises people the first time.
- Titles start repeating after their own position. If rows
$1:$1are the title, row 1 appears on page 1 as normal content. It repeats only from page 2 on. It does not print twice on page 1. - Rows below the title row on page 1 are normal. If you set
$4:$4as the title while rows 1 to 3 hold a report name, page 1 prints rows 1 to 3 as usual, then row 4 and the data. Pages 2 onward print only row 4 above the data. Rows 1 to 3 do not repeat. - Titles on a page that precedes them do not appear. If the title row is row 4 and a page break puts rows 1 to 3 on their own page, that page does not show row 4 above them. Titles repeat only on pages after the one where they first occur.
- Page order matters for columns. With the default "Down, then over" order, all pages for the left columns print first, then the pages for the right columns. Repeated columns appear on each right-hand page. If you choose "Over, then down", the page sequence changes but the repeated content stays the same.
- Titles use cell values and formatting, not formulas you rewrite. Excel prints the actual cells, so any formulas, fills, borders, and wrapped text in the title rows print as they appear on screen.
Interaction with other settings
Print titles take space on each page. A title block of four rows removes four rows of room from every page after the first, so the data per page drops. This matters in three places.
| Setting | Effect on print titles |
|---|---|
| Scaling (Fit to 1 page wide) | Titles scale with everything else. Column titles on a one-page-wide fit are unnecessary, because no horizontal split occurs. |
| Manual page breaks | Titles repeat after each break. A break placed immediately below a title row leaves a page with titles only. |
| Print area | Title rows and columns must lie inside the print area to print as titles. If row 1 is outside the area, Excel does not include it. |
| Headers and footers | Print titles are part of the page body. Page headers sit in the margin above them and do not conflict. |
The print area point deserves care. If your print area is $A$5:$H$200 and your title row is row 4, Excel still prints row 4 above the data on pages after the first, because it treats the title rows as an addition to the area. Row 4 does not print on page 1, since it lies outside the area. To get consistent output, include the header row in the print area, so page 1 and later pages match.
Choosing good title rows
A few habits make repeated titles useful.
- Repeat only the column-label row, not the whole title block. A large report banner on every page wastes space.
- Keep the label row to one line. Wrapped multi-line headers cost vertical space on every page.
- Use a fill color or bottom border so the repeated row is visually distinct from data.
- For wide tables, repeat the identifying column, then check Print Preview to make sure the repeated column plus the new columns still fit the page width.
Repeated columns also reduce horizontal room. If column A is wide, such as 30 characters of names, pages to its right have less space for data, and you may get more pages than expected. In that case, narrow the column or use scaling.
Setting titles with a selection shortcut
You do not have to click in the boxes. Select the header row first. Open the Sheet tab and click in the Rows to repeat at top box. Excel often fills it from your selection, or you can type the reference directly:
Rows to repeat at top: $1:$1
Columns to repeat at left: $A:$BTyping is quick when you know the reference. Use the $ signs. A reference without them, such as 1:1, is converted to the absolute form, but a typo such as A1:H1 is a cell range, not a row range, and Excel will reject or misread it.
Checking and clearing print titles
Verify with Print Preview (File > Print) and scroll to page 2. Page Layout view also shows repeated rows at the top of later pages. Normal view does not show them, and neither does Page Break Preview.
To remove titles, open the Sheet tab and delete the text in the Rows to repeat at top or Columns to repeat at left box, then choose OK.
Under the hood, Excel stores print titles as a sheet-level defined name called Print_Titles. You can see it in the Name Manager (Formulas > Name Manager), listed with a scope of that worksheet. Its value looks like =Sheet1!$A:$B,Sheet1!$1:$1. Knowing this helps in two situations. First, if you copy a sheet within the workbook, the copy gets its own Print_Titles. Second, if the name is damaged, for example after you delete the sheet it points to, you can delete the stale name from Name Manager and set titles again.
Common problems
- Titles do not repeat. Check that you are on the right sheet, since print titles are per sheet. Also check that you are viewing page 2 or later. Page 1 shows the title row only once.
- The Print Titles button is grayed out. It is disabled while you edit a cell, while a chart is selected, and in some views. Press Enter or Esc, click a cell, and try again.
- Wrong rows repeat. The reference may be outdated after you moved or inserted rows. Reopen the Sheet tab and reselect the rows.
- A page contains only the titles. A manual page break sits directly below the title rows, or scaling leaves an empty remainder. Remove or move the break in Page Break Preview.
- Different sheets need different titles. Set them on each sheet. Selecting several sheets as a group and then setting titles applies the same range to all of them, which is useful only when their layouts match.
Setting titles with VBA
The PageSetup object exposes both settings. They take the reference as a string:
Sub SetPrintTitles()
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = "$A:$A"
End With
End Sub
Sub ClearPrintTitles()
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
End SubAssigning an empty string clears the setting. This pairs with the page setup macro shown elsewhere in this tutorial, where .PrintTitleRows = "$1:$1" sits beside the print area and scaling properties.
Exercise
Your report's column headings are in row 3, and rows 1 and 2 hold a title and date. The data runs from row 4 to row 300, and you want pages 2 and later to show the column headings but not the title and date. What do you enter in Rows to repeat at top, and what happens to rows 1 and 2 on page 1?
Show answer
Enter $3:$3. Page 1 prints rows 1 to 3 and the data below them as ordinary content. Pages 2 and later print row 3 at the top, followed by the next block of data. Rows 1 and 2 do not repeat because they are outside the title range.
Exercise
A table spans columns A to P and prints on two pages across. Column A holds customer names. Page 2 shows only numbers and the reader cannot tell which customer each row belongs to. How do you fix it, and how can you confirm the fix without printing?
Show answer
In Page Layout > Print Titles, set Columns to repeat at left to $A:$A and choose OK. Then open File > Print, or use Page Layout view, and look at page 2. Column A should appear at its left edge. If it pushes some columns onto a third page, narrow column A or adjust scaling.