Hi Mrgibr:
Try the following on your sample workbook. If works as expected you can apply it on your original file.
Code
Public strWbName As String
Sub ttest()
Dim ws As Worksheet
Dim pvtTbl As PivotTable
Dim pvtFld As PivotField
Dim pvtitm As PivotItem
Set ws = ThisWorkbook.Sheets("Summary")
Application.ScreenUpdating = True
With ws
Set pvtTbl = .PivotTables(1)
End With
With pvtTbl
.ClearAllFilters
Set pvtFld = .PivotFields(1)
j = pvtFld.PivotItems.Count
k = 1
For x = j To 1 Step -1
a = pvtFld.PivotItems(x)
If a <> "(blank)" Or x <> 1 Then ' change accordingly
pvtFld.PivotItems(x).Visible = False
End If
Next
For x = 1 To j
If x = j Then Exit Sub
pvtFld.PivotItems(x + 1).Visible = True
pvtFld.PivotItems(x).Visible = False
strWbName = pvtFld.PivotItems(x + 1)
CreateWb
Next
End With
Application.ScreenUpdating = True
End Sub
Sub CreateWb()
Dim wsMain As Worksheet
Dim wbNw As Workbook
Dim wbMain As Workbook
Dim rngToCpy
strpath = "C:\D-Drive\SET 1\"
Set wbMain = ThisWorkbook
Set wbNw = Workbooks.Add
Application.ScreenUpdating = False
With wbMain
Set wsMain = .Sheets("Summary")
End With
With wsMain
x = .Rows.Count
Set rngToCpy = .Range("B2", .Range("B" & x).End(xlUp).Offset(0, 1))
.Activate
rngToCpy.Copy
End With
With wbNw.Sheets("Sheet1")
.Range("A1").PasteSpecial xlValues
.Range("A1").PasteSpecial xlFormats
.Columns.AutoFit
Application.CutCopyMode = False
End With
wbNw.SaveAs strpath & strWbName
wbNw.Close True
Application.ScreenUpdating = True
End Sub
Display More
Regards
Maqbool