Sub DeletePivotTables()
Dim Pt As PivotTable
Dim Ws As Worksheet
'Loop through worksheets
For Each Ws In ActiveWorkbook.Worksheets
Worksheets(Ws.Name).Select
'Loop through pivot tables
For Each Pt In Ws.PivotTables
'Delete pivot table
Pt.PivotSelect "", xlDataAndLabel, True
Selection.Delete Shift:=xlToLeft
'Exit Sub
'Optional: Get out
Next Pt
Next
Ws End
Sub
Dim Pt As PivotTable
Dim Ws As Worksheet
'Loop through worksheets
For Each Ws In ActiveWorkbook.Worksheets
Worksheets(Ws.Name).Select
'Loop through pivot tables
For Each Pt In Ws.PivotTables
'Delete pivot table
Pt.PivotSelect "", xlDataAndLabel, True
Selection.Delete Shift:=xlToLeft
'Exit Sub
'Optional: Get out
Next Pt
Next
Ws End
Sub
No comments:
Post a Comment