So I have figured out how to get a pivot table to save to a specified folder as .PDF, but I am curious if anyone knows if there is a way to loop my code instead of having it all separated?
My code works, but am just curious if there is a way to condense it?
Sub Test1234()
'''Sales Team1'''
Sheets("Worksheet1").Activate
'''adjust the range if the Pivot Table moves'''
Range("C3").Select
ActiveSheet.PivotTables("PivotTable2").PivotFields("Vertical").ClearAllFilters
'''adjust the vertical name in the quotes below'''
ActiveSheet.PivotTables("PivotTable2").PivotFields("Vertical").CurrentPage = _
"Sales Team1"
Sheets("Worksheet1").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="Desktop" & Format(Date, " dd.mm.yyyy")
'''Sales Team2'''
Sheets("Worksheet1").Activate
'''adjust the range if the Pivot Table moves'''
Range("C3").Select
ActiveSheet.PivotTables("PivotTable2").PivotFields("Vertical").ClearAllFilters
'''adjust the vertical name in the quotes below'''
ActiveSheet.PivotTables("PivotTable2").PivotFields("Vertical").CurrentPage = _
"Sales Team2"
Sheets("Worksheet1").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="Desktop" & Format(Date, " dd.mm.yyyy")
'''Sales Team3'''
Sheets("Worksheet1").Activate
'''adjust the range if the Pivot Table moves'''
Range("C3").Select
ActiveSheet.PivotTables("PivotTable2").PivotFields("Vertical").ClearAllFilters
'''adjust the vertical name in the quotes below'''
ActiveSheet.PivotTables("PivotTable2").PivotFields("Vertical").CurrentPage = _
"Sales Team3"
Sheets("Worksheet1").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="Desktop" & Format(Date, " dd.mm.yyyy")
End Sub