My misunderstanding, you're looking for the sum of each printed page only.
Also corrects number of records on each page, there were only 24 after page 1.
Hope this works.
Option Explicit
Sub PrintSpecfic()
Dim strCriteria1 As String, strCriteria2 As String
Dim X As Long, LastRow As Long, StartSum As Long
Dim i As Integer
strCriteria1 = Sheet1.Range("AH1").Value
strCriteria2 = Sheet1.Range("AI1").Value
' clear print sheet
With Sheet2
.Select
.UsedRange.Delete
.Cells.PageBreak = xlPageBreakNone
.Cells(1, 1).Select '<~~ where paste takes place
End With
' filter and copy
On Error Resume Next
With Sheet1
.Select
.AutoFilterMode = False
.Range("A2:AI2").AutoFilter Field:=34, Criteria1:=strCriteria1
.Range("A2:AI2").AutoFilter Field:=35, Criteria1:=strCriteria2
' Copy relevant range
.Range("A1:AG" & .Cells(Rows.Count, "B").End(xlUp).Row).SpecialCells(xlCellTypeVisible).Copy
Sheet2.Paste
Application.CutCopyMode = False
.AutoFilterMode = False
End With
' sheet to print
With Sheet2
.Select
.Cells(1, 1).Select '<~~ de-selects the copied range
LastRow = .Cells(Rows.Count, "B").End(xlUp).Row
.Range(Cells(LastRow, 3), Cells(LastRow, 33)).ClearContents
StartSum = 3
i = 28 '<~~ first row needing inserted
Do While i < .UsedRange.Rows.Count
.Cells(i, 1).EntireRow.Insert '<~~ row for formulas
.Cells(i, 14).Formula = "=SUM(N" & StartSum & ":N" & i - 1 & ")"
.HPageBreaks.Add Before:=Rows(i + 1)
StartSum = i + 1
i = i + 26
Loop
'formula for last row
LastRow = .Cells(Rows.Count, "B").End(xlUp).Row
.Cells(LastRow, 14).Formula = "=SUM(N" & StartSum & ":N" & LastRow - 1 & ")"
End With
'ActiveWindow.SelectedSheets.PrintOut Copies:=1
End Sub
Bookmarks