Sub CreatePDF()
Dim wb As Workbook, wsData As Worksheet, wsDest As Worksheet, cName As Range, cList As Range, cell As Range
Dim lRow As Long, i As Integer, wsInv As Worksheet
Dim fPath As String, fFolder As String, fName As String
fPath = "C:\Users\" & Application.UserName & "\Documents\Invoices"
If Dir(fPath, vbDirectory) = "" Then
MkDir fPath
End If
Set wb = ThisWorkbook: Set wsData = wb.Sheets("Sheet1"): Set wsDest = wb.Sheets("Sheet2")
lRow = wsDest.Columns("B").Rows(wsDest.Rows.Count).End(xlUp).Row
Set cName = wsData.Range("T1"): Set cList = wsDest.Range("B9:B" & lRow)
Set wsInv = Sheets.Add(After:=wb.Sheets(wb.Sheets.Count))
i = 1
For Each cell In cList
cName.Value = cell.Value
fName = cName.Value
wsData.Range("A1:I46").Copy
wsInv.Cells(i, 1).PasteSpecial Paste:=xlPasteValues
i = i + 46
wsInv.HPageBreaks.Add (wsInv.Rows(i))
Next cell
wsInv.PageSetup.FitToPagesTall = 1
Application.DisplayAlerts = False
wsInv.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fPath & "\Invoices.pdf", IgnorePrintAreas:=False, OpenAfterPublish:=False, _
IncludeDocProperties:=True
wsInv.Delete
Application.DisplayAlerts = True
End Sub