Help with code??

M

Mekinnik

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
 
D

Don Guillett

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top