With ActiveSheet
On Error Resume Next
For iCtr = 2 To .Rows.Count
.HPageBreaks.Add before:=.Cells(iCtr, "A")
If Err.Number = 0 Then
'ok
Else
Err.Clear
MsgBox "Error with: " & iCtr & vbLf & iCtr - 1 & " worked ok"
Exit For
End If
Next iCtr
On Error GoTo 0
End With
End Sub
With ActiveSheet
On Error Resume Next
For iCtr = 2 To .Rows.Count
.HPageBreaks.Add before:=.Cells(iCtr, "A")
If Err.Number = 0 Then
'ok
Else
Err.Clear
MsgBox "Error with: " & iCtr & vbLf & iCtr - 1 & " worked ok"
Exit For
End If
Next iCtr
On Error GoTo 0
End With
End Sub
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.