I have code to show the first page break on a "page preview" where text "(continues)" is in Col A
I need to have the second break break at "Signature Saes Manager"
It would be appreciated if someone could assist me
I need to have the second break break at "Signature Saes Manager"
It would be appreciated if someone could assist me
Code:
Sub Print_Preview ()
Dim C As Range, f, lastrow&, pgCount%
With ActiveSheet
lastrow = .Cells(.Rows.Count, "b").End(xlUp).Row
With .PageSetup
.PrintGridlines = True
.PrintArea = "B3529:R5270"
.PrintTitleRows = ""
.PrintTitleColumns = ""
.LeftHeader = "&D&T"
.Orientation = xlLandscape
.FitToPagesWide = 1
.Zoom = 69
.ScaleWithDocHeaderFooter = True
End With
ActiveWindow.View = xlNormalView
.Cells.PageBreak = xlPageBreakNone
For Each r In .Range("B3529:b5270")
If InStr(1, r.Value, "(continues)", vbTextCompare) > 0 Then
.Rows(r.Row + 2).PageBreak = xlPageBreakManual
End If
Next r
ActiveWindow.View = xlPageBreakPreview
For Each r In .Range("B3529:b5270")
If InStr(1, r.Value, "(continues)", vbTextCompare) > 0 Then
pgCount = pgCount + 1
On Error Resume Next
Set .HPageBreaks(pgCount).Location = .Cells(r.Row + 2, 4)
End If
Next r
End With
ActiveSheet.Range("B3539").Select
End Sub