View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Help with code??

Try this
Sub putbreaks()
ActiveSheet.ResetAllPageBreaks
For i = 20 To Cells(Rows.Count, "a").End(xlUp).Row Step 19
ActiveSheet.HPageBreaks.Add Befo=Cells(i, "a")
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mekinnik" wrote in message
...
How could I modify this code to insert a page break instead of a row and
do
it at the top of every 19th row instead of row 5?


Sheets("Sheet1").Select
Range("A1").Select 'Set range to start point
Do While ActiveCell.Value < ""
ActiveCell.Offset(5, 0).Select
Selection.EntireRow.Insert
ActiveCell.Offset(1, 0).Select