View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
KK[_3_] KK[_3_] is offline
external usenet poster
 
Posts: 1
Default How to Programmatically Insert a Page Break Every Nth Row in a Range

Sub InsertPBreakEveryNthRow()
Dim i As Integer

For i = 2 To ActiveSheet.UsedRange.Rows.Count
If i Mod 8 = 1 Then
Worksheets("Sheet1").Rows(i).PageBreak =
xlPageBreakManual
End If
Next
End Sub