[COLOR=#006400]Sub SplitWorkbookToPDF[/COLOR]()
Const path = "C:\folder\subfolder"
Dim WbMain As Workbook, Wb As Workbook, Ws As Worksheet, Cel As Range, Rng1 As Range, Rng2 As Range[COLOR=#006400], w As Long[/COLOR]
Dim Coll As New Collection, Itm As Variant
Set WbMain = ThisWorkbook: Set Ws = WbMain.Sheets("Index")
Set Rng1 = Ws.Range("A2", Ws.Range("A" & Rows.Count).End(xlUp))
Set Rng2 = Ws.Range("A1", Ws.Range("A" & Rows.Count).End(xlUp))
Optimize True
'get unique list of workbooks
For Each Cel In Rng1
On Error Resume Next: Coll.Add CStr(Cel), CStr(Cel): On Error GoTo 0
Next
'filter list in sheet "Index", add workbooks & copy sheets
Ws.AutoFilterMode = False
For Each Itm In Coll
Rng2.AutoFilter Field:=1, Criteria1:=Itm
Set Wb = Workbooks.Add
For Each Cel In Rng1.SpecialCells(xlCellTypeVisible)
WbMain.Sheets(Cel.Offset(, 1).Value).Copy before:=Wb.Sheets(Wb.Worksheets.Count)
Next Cel
[COLOR=#006400] For w = 1 To Wb.Sheets.Count - 1
Wb.Sheets(w).Select False
Next w[/COLOR]
[COLOR=#006400] ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=path & Chr(92) & Itm & Format(Now, " YYMMDD HHMMSS")[/COLOR]
Wb.Close False
Ws.AutoFilterMode = False
Next Itm
Optimize False
[COLOR=#006400]End Sub
[/COLOR]
[COLOR=#006400]Private Sub Optimize(TrueFalse As Boolean)[/COLOR]
With Application
.ScreenUpdating = Not TrueFalse
.Calculation = xlCalculationManual
If TrueFalse = True Then Else .Calculation = xlCalculationAutomatic
End With
[COLOR=#006400]End Sub[/COLOR]