Set Rows to Repeat at Top of Multiple Worksheets
top of page

Set Rows to Repeat at Top of Multiple Worksheets


If you right click on a worksheet in Excel, you'll be able to 'Select All Sheets' and perform many editing tasks on all worksheets simultaneously. However, under Page Layout . . . Page Setup . . .on the Sheet tab, you will not be able to enter a range in the Print titles section for, "Rows to repeat at top" - it is grayed out, disabled. This setting makes column headers in one or more rows, repeat on each page of a worksheet printed to a PDF or hard copy.

Gord Dibben posted Visual Basic code here which will allow you to designate a range of rows to be entered in the "Rows to repeat at top" field on all worksheet.

Press ALT + F11 to enter Visual Basic and enter the below vba code in a new module [right click on the workbook name in the project list and select Insert . . . Module]. Designate the rows on the line which begins, "ws.PageSetup.PrintTitleRows", preceding each row number with a dollar sign. Press play and the row range will be entered for each worksheet.

Sub test() Dim ws As Worksheet For Each ws In ActiveWorkbook.Sheets 'For Each ws In ActiveWindow.SelectedSheets If ws.Type = xlWorksheet Then ws.PageSetup.PrintTitleRows = "$1:$3" End If Next End Sub


bottom of page