How do you make a page break happen after every cell...copy?

G

Guest

I'm trying to make a page break happen after every cell ... the rowshave been merged (25/cell) and I want a page break every 25 rows. How do I get that to happen without inserting a page break manually every 25 rows?
 
D

Dave Peterson

A macro like this???

Option Explicit
Sub testme01()

Dim iRow As Long
Dim LastRow As Long

With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row

For iRow = 26 To LastRow Step 25
.HPageBreaks.Add Before:=.Cells(iRow, "A")
Next iRow
End With

End Sub


If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
 

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