ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro to repeat 2 contiguous rows to top of each page (https://www.excelbanter.com/excel-discussion-misc-queries/179294-macro-repeat-2-contiguous-rows-top-each-page.html)

jwmbem

Macro to repeat 2 contiguous rows to top of each page
 
I need a macro to repeat rows 23 and 24 at top of each page. I must use page
set up to add rows 3 &4 so can't use it for rows 23 and 24 as well. Please
write macro as I would use it, using rows 23 and rows 24 to repeat at top of
each page.
thank you
--
J Macho

Tom Hutchins

Macro to repeat 2 contiguous rows to top of each page
 
The easiest way is to pull the values from rows 23 & 24 to rows 5 & 6.
A5: =A23 B5: =B23
A6: =A24 B6: =B24 etc.

You can hide these rows until you are ready to print. You can use a simple
macro like the following to unhide rows 5 & 6 and set rows 3:6 as your print
titles.

Sub Macro1()
Rows("5:6").EntireRow.Hidden = False
With ActiveSheet.PageSetup
.PrintTitleRows = "$3:$6"
End With
End Sub

Hope this helps,

Hutch

"jwmbem" wrote:

I need a macro to repeat rows 23 and 24 at top of each page. I must use page
set up to add rows 3 &4 so can't use it for rows 23 and 24 as well. Please
write macro as I would use it, using rows 23 and rows 24 to repeat at top of
each page.
thank you
--
J Macho


jwmbem

Macro to repeat 2 contiguous rows to top of each page
 
Thanks Tom will give it a shot!
--
J Macho


"Tom Hutchins" wrote:

The easiest way is to pull the values from rows 23 & 24 to rows 5 & 6.
A5: =A23 B5: =B23
A6: =A24 B6: =B24 etc.

You can hide these rows until you are ready to print. You can use a simple
macro like the following to unhide rows 5 & 6 and set rows 3:6 as your print
titles.

Sub Macro1()
Rows("5:6").EntireRow.Hidden = False
With ActiveSheet.PageSetup
.PrintTitleRows = "$3:$6"
End With
End Sub

Hope this helps,

Hutch

"jwmbem" wrote:

I need a macro to repeat rows 23 and 24 at top of each page. I must use page
set up to add rows 3 &4 so can't use it for rows 23 and 24 as well. Please
write macro as I would use it, using rows 23 and rows 24 to repeat at top of
each page.
thank you
--
J Macho



All times are GMT +1. The time now is 08:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com