Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Could anybody help me with the VBA-code needed ub this? I have 3000 rows in
one sheet and I would like to print only 10 rows for each paper. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
One way:
Option Explicit Sub testme() Dim myCell As Range Dim iRow As Long Dim LastRow As Long Dim FirstRow As Long With Worksheets("Sheet1") FirstRow = 11 LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row .ResetAllPageBreaks For iRow = FirstRow To LastRow Step 10 .Cells(iRow, "A").PageBreak = xlPageBreakManual Next iRow End With End Sub I put the first pagebreak before row 11. I used column A to find out the last used row. If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm kativa wrote: Could anybody help me with the VBA-code needed ub this? I have 3000 rows in one sheet and I would like to print only 10 rows for each paper. -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thank you very much! The way doesn't matter until the code works and this
did. You made my day :=) -Kate "Dave Peterson" kirjoitti: One way: Option Explicit Sub testme() Dim myCell As Range Dim iRow As Long Dim LastRow As Long Dim FirstRow As Long With Worksheets("Sheet1") FirstRow = 11 LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row .ResetAllPageBreaks For iRow = FirstRow To LastRow Step 10 .Cells(iRow, "A").PageBreak = xlPageBreakManual Next iRow End With End Sub I put the first pagebreak before row 11. I used column A to find out the last used row. If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted.htm kativa wrote: Could anybody help me with the VBA-code needed ub this? I have 3000 rows in one sheet and I would like to print only 10 rows for each paper. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
insert page break when there is a change in the row value | Excel Worksheet Functions | |||
cannot insert page break | Excel Discussion (Misc queries) | |||
Automatically insert page break every 6 rows in excel doc | Excel Discussion (Misc queries) | |||
Insert Page Break Question | Excel Discussion (Misc queries) | |||
Insert Page Break | Excel Discussion (Misc queries) |