Hello,
I currently have this code which works no problem but I am wondering if I can somehow get the code to look for the Header (in row 1) that contains "Transaction Date" and then look in the column for *Total* and then create a Page Break below.
Thanks!
I currently have this code which works no problem but I am wondering if I can somehow get the code to look for the Header (in row 1) that contains "Transaction Date" and then look in the column for *Total* and then create a Page Break below.
VBA Code:
Sub PageBreak()
ActiveSheet.ResetAllPageBreaks
Dim fRng As Range, Faddr As String
With ActiveSheet.Range("R2:R" & ActiveSheet.Range("R" & Rows.Count).End(xlUp).Row)
Set fRng = .Cells.Find(What:="*Total*", LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext)
If Not fRng Is Nothing Then
Faddr = fRng.Address
Do
If Not fRng Is Nothing Then
fRng.Offset(1).PageBreak = xlPageBreakManual
End If
Set fRng = .FindNext(fRng)
If fRng Is Nothing Then
Exit Do
End If
If fRng.Address = Faddr Then
Exit Do
End If
Loop
End If
End With
End Sub
Thanks!