ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Print one line per page (https://www.excelbanter.com/excel-discussion-misc-queries/207400-print-one-line-per-page.html)

Eric

Print one line per page
 
In Excel 2003, I have a table, where each line represents one date. I'd like
to print each line (each date) on a separate page (because the hardcopy will
go into separate documentation files). Each page will also include the page
header and footer, and the header rows from the table.

Obviously I could insert page breaks manually at every row, but the table
contains dozens of rows and that seems like an unnecessary chore. Can anyone
suggest an easier way?

Thanks.


Otto Moehrbach[_2_]

Print one line per page
 
Eric
This little macro will print each row as a separate print job. That
will print each row on a separate page. HTH Otto
Sub PrintEachRow()
Dim rColA As Range
Dim i As Range
Set rColA = Range("A2", Range("A" & Rows.Count).End(xlUp))
For Each i In rColA
i.Resize(, 5).PrintOut
Next i
End Sub

"Eric" wrote in message
...
In Excel 2003, I have a table, where each line represents one date. I'd
like
to print each line (each date) on a separate page (because the hardcopy
will
go into separate documentation files). Each page will also include the
page
header and footer, and the header rows from the table.

Obviously I could insert page breaks manually at every row, but the table
contains dozens of rows and that seems like an unnecessary chore. Can
anyone
suggest an easier way?

Thanks.




Sheeloo[_3_]

Print one line per page
 
Adapted from http://excel.tips.net/Pages/T002792_...ge_Breaks.html
================================================== ===========================

The following macro will do the trick:

Sub PageBreak()
Dim CellRange As Range
Dim TestCell As Range
Set CellRange = Selection
For Each TestCell In CellRange
ActiveSheet.Rows(TestCell.Row).PageBreak = xlPageBreakNone
ActiveSheet.Rows(TestCell.Row).PageBreak = xlPageBreakManual
Next TestCell
End Sub

To use the macro, simply

"Eric" wrote:

In Excel 2003, I have a table, where each line represents one date. I'd like
to print each line (each date) on a separate page (because the hardcopy will
go into separate documentation files). Each page will also include the page
header and footer, and the header rows from the table.

Obviously I could insert page breaks manually at every row, but the table
contains dozens of rows and that seems like an unnecessary chore. Can anyone
suggest an easier way?

Thanks.


Eric

Print one line per page
 


"Sheeloo" wrote:

Adapted from http://excel.tips.net/Pages/T002792_...ge_Breaks.html
================================================== ===========================

The following macro will do the trick:

Sub PageBreak()
Dim CellRange As Range
Dim TestCell As Range
Set CellRange = Selection
For Each TestCell In CellRange
ActiveSheet.Rows(TestCell.Row).PageBreak = xlPageBreakNone
ActiveSheet.Rows(TestCell.Row).PageBreak = xlPageBreakManual
Next TestCell
End Sub

To use the macro, simply

"Eric" wrote:

In Excel 2003, I have a table, where each line represents one date. I'd like
to print each line (each date) on a separate page (because the hardcopy will
go into separate documentation files). Each page will also include the page
header and footer, and the header rows from the table.

Obviously I could insert page breaks manually at every row, but the table
contains dozens of rows and that seems like an unnecessary chore. Can anyone
suggest an easier way?

Thanks.



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

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