- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to Repeat Rows on Top of Every Printout Except the Last Page in Excel?
When you have enormous datasets that span numerous pages and want to make sure that important information stays visible at the top of each page for improved reading and context, this handy Excel tool is tremendously helpful. In this video, we'll walk you through each step of setting up row repetition in Excel so that it appears at the top of every printout.
Learning this trick will surely enhance the overall presentation and usefulness of your Excel documents, regardless of whether you are working with financial reports, data tables, or any other spreadsheet containing numerous pages. So let's get started and learn how to grasp this practical function to improve the quality and information of your Excel printing!
Repeat Rows on Top of Every Printout Except the Last Page
Here we will first create a VBA module and then select the range of cells to complete the task. So let us see a simple process to know how you can repeat rows on top of every printout except the last page in Excel.
Step 1
Consider an Excel sheet where the data in the sheet is similar to the below image.
First, right-click on the sheet name and select View Code to open the VBA application.
Right-click > View Code.
Step 2
Then click on Insert and select Module, then copy the below code into the text box.
Insert > Module > Copy.
Code
Sub RepeatRowsExceptLastPage() Dim xPages As Long, I As Integer, xRg As Range On Error Resume Next xPages = ActiveSheet.PageSetup.Pages.Count Set xRg = Application.InputBox("Please select a row you need to repeat:", "Repeat Rows Except", , , , , , Type:=8) If xRg Is Nothing Then Exit Sub On Error Resume Next If xPages > 0 Then With ActiveSheet.PageSetup .PrintTitleRows = xRg.AddressLocal ActiveSheet.PrintOut from:=1, To:=xPages - 1 .PrintTitleRows = "" ActiveSheet.PrintOut from:=xPages, To:=xPages End With End If End Sub
Step 3
Then click F5 to run the module. Then select the range of cells and click OK to complete the task.
F5 > Select Cells > OK
Then you will see that all the pages are printed out with certain rows repeating on top, except the final sheet.
Conclusion
In this tutorial, we have used a simple example to demonstrate how you can repeat rows on top of every printout except the last page in Excel to highlight a particular set of data.