How to Repeat Rows at Top in Excel (3 Suitable Ways)

 

How to Repeat Rows at Top in Excel: 3 Suitable Ways 

The sample dataset contains some items, the quantity of each item, and the total number of sales of each item. As this is a quite large dataset, you might get lost while scrolling. We’ll repeat the top rows that function as column headers.

excel rows to repeat at top


Method 1 – Repeat Rows at the Top in Excel Using the Page Setup Tool

STEPS:

  • Go to the Page Layout tab from the ribbon.
  • Under the Page Setup category, click on the anchor icon to open the Page Setup dialog. Alternatively, you can use the keyboard shortcut Alt + P, then press the S + P keys together to display the Page Setup window.

excel rows to repeat at top

  • This will display the Page Setup dialog box.
  • Go to the Sheet menu and click on the arrow next to Rows to repeat at top.

excel rows to repeat at top

  • In the dialog box Page Setup – Rows to repeat at top, select the range of rows you want to repeat at top. We selected $1:$4.
  • Press Enter.

excel rows to repeat at top

  • This will take you back to the Page Setup dialog. Click on Print.

excel rows to repeat at top

  • A print window will appear with the page preview on the right.

  • Go to the next page to see the rows at the top as well.

Read More: How to Repeat Rows in Excel When Printing


Method 2 – Freeze Panes to Repeat Rows at the Top While Scrolling

STEPS:

  • Select the first cell after the row you want to freeze. If you want to freeze the top four rows, select A5.
  • Go to the View tab from the ribbon.
  • Click on the Freeze Panes drop-down menu under the Window group.
  • Select the Freeze Panes option from the drop-down.

  • If you scroll down, the rows will be locked at the top.

Read More: How to Repeat Rows at Top of Specific Pages in Excel


Method 3 – Apply Excel VBA to Repeat Rows at the Top

STEPS:

  • Go to the Developer tab from the ribbon.
  • From the Code category, click on Visual Basic to open the Visual Basic Editor. Or, press Alt + F11 to open the Visual Basic Editor.

excel rows to repeat at top

  • You can also right-click on your worksheet and select View Code. This will also take you to Visual Basic Editor.

  • Copy and paste the VBA code shown below into the module.

VBA Code:

Sub Rows_to_Repeat()
Dim rw As Long
For rw = 1 To Worksheets.Count
    Sheets(rw).PageSetup.PrintTitleRows = "$1:$4"
Next rw
End Sub
  • Run the code by clicking on the RubSub button or pressing the keyboard shortcut F5.

Note: You don’t need to change the code. All you can do is just change the range as per your requirements.
  • Go to the File tab from the ribbon.

  • Click on Print.
  • You’ll get a page preview on the right.

  • Go to the next page to see if the top rows remained.

 


Things to Keep in Mind

  • If we select over one sheet, the Rows to Repeat at Top box in the Page Setup dialog box is unavailable.
  • Click any sheet that is not already chosen to remove the selection of all sheets.
  • Ungroup Worksheets may be found on the menu that appears when you right-click the tab of a specified sheet if there are no unselected sheets present.
  • While using Excel VBA, save the spreadsheet as .xlsm.

Download the Practice Workbook


Related Articles


<< Go Back to Repeat in Excel | Excel Cell Format | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Sabrina Ayon
Sabrina Ayon

Sabrina Ayon, a Computer Science and Engineering graduate from United International University, has been an integral part of the ExcelDemy project for two years. She authored 150+ articles, excelling in instructing through visually engaging Excel tutorials. With a passion for teaching, Sabrina conducted sessions on Excel VBA, sharing her knowledge and insights with others. Currently holding the position of Project Manager for the ExcelDemy Visual Development Project, she oversees various aspects of the project, ensuring its smooth operation... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo