austinmb
austinmb

Reputation: 69

How to add page breaks every 30 rows

This is what I have:

 Sub Page_Break()
     For i = 1 To 799 Step 30
         ActiveSheet.HPageBreaks.Add Before:=Cells(i + 1, 1)
     Next
 End Sub

Upvotes: 0

Views: 184

Answers (1)

Sam
Sam

Reputation: 5721

Do the For like this:

For i = 30 To 799 Step 30

The rest of the code is fine, unless you have merged cells and other complicating stuff.

Upvotes: 1

Related Questions