Hi cirrol,
Here's a routine I use I do this:
Sub ResetPivotTables()
Dim pt As PivotTable, pt_s As PivotTable, iPTCount As Long, pt_rng As Variant
Dim wb As Workbook, ws As Worksheet, sh As Worksheet
Application.ScreenUpdating
Set wb = ActiveWorkbook
Set ws = wb.Sheets("PivotData") ' < Change to the Pivot Source Sheet name
Set pt_rng = ws.UsedRange.Resize(ws.Cel
Set ws = ActiveSheet
Set pt_s = Nothing
iPTCount = 0
For Each sh In wb.Sheets
If sh.PivotTables.Count > 0 Then
sh.Activate
iPTCount = iPTCount + 1
For Each pt In sh.PivotTables
If iPTCount = 1 Then
sh.PivotTableWizard SourceType:=xlDatabase, SourceData:=pt_rng
Set pt_s = pt
Else
sh.Cells(pt.TableRange2.Ro
sh.PivotTableWizard SourceType:=xlPivotTable, _
SourceData:="[" & wb.Name & "]" & pt_s.Parent.Name & "!" & pt_s.Name
End If
Next pt
End If
Next sh
ws.Activate
Application.ScreenUpdating
End Sub
Jim
Main Topics
Browse All Topics





by: matthewspatrickPosted on 2005-01-20 at 14:21:05ID: 13098247
Hi Piet,
I usually get around this by using dynamic ranges as my PivotTable sources. That way, as I add columns and rows, all I have to do is refresh
the PivotTables.
Regards,
Patrick