Repeat a range of cells on each page break (different page)

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
2,169
Office Version
  1. 2016
Platform
  1. Windows
Hello,

Is it possible to repeat certain range of data on each sheet as with the headers in

Code:
 .PageSetup.PrintTitleRows = "$1:$2"
???

The code below is just an example.

I have a code similar to the one below here which I use to set my page breaks.

Sometimes, the columns grow so that avoiding multiple vertical page breaks cause readability issues.
I think when I am able to get the first 3 columns repeated, it would help me to easily reference items.

But since different rows of data will appear on a sheet of there are multiple horizontal breaks, I don't know how to go about it.

I will be glad if someone can show me the way.

Thanks in advance.

Code:
Sub HPage_Breaks()
Dim rpp As Long, rh As Long, i As Long, lr As Long, lc As Long
lr = Sheet2.Cells.Find("*", , , , xlByRows, xlPrevious).Row
lc = Sheet2.Cells.Find("*", , , , xlByColumns, xlPrevious).Column
  
With Sheet2
    .ResetAllPageBreaks
    .PageSetup.Zoom = 50
    .PageSetup.PrintArea = .Range("A2:O" & lr).Address  
    .PageSetup.PrintTitleRows = "$1:$2" 
    .HPageBreaks.Add (.Cells(52, 1))
    For i = 1 To lr / (51)
        .HPageBreaks.Add (.Cells(.HPageBreaks(i).Location.Row + 51, 1))
    Next i
End With
Sheet2.PrintOut
End Sub
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Hello,

Is it possible to repeat certain range of data on each sheet as with the headers in .PageSetup.PrintTitleRows = "$1:$2" ???

Did you try ...
VBA Code:
.PageSetup.PrintTitleColumns = "$A:$C"
 
Upvote 0
Solution

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top