Sub Loopingpagebreaks()
Sheets("sheet2").Select
Range("A65536").End(xlUp).Select
On Error Resume Next
Do
If IsEmpty(ActiveCell) = False Then
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
ActiveCell.Offset(-1, 0).Select
End If
ActiveCell.Offset(-1, 0).Select
Loop Until IsEmpty(ActiveCell.Offset(1, 0)) = False
On Error GoTo 0
End Sub