Hi there
I'm using Excel 2007.
I have the following problem. I have 5 large data sheets (over 400,000 records each) that I want to analyse using various different sheets utilizing pivot tables. I want to update the input sheets periodically, and then just have the pivot tables in the analysis sheets change their data source.
To achieve this I run the following code to update the data source;
Option Explicit
Sub ChangeSource()
Dim sh As Worksheet, qy As QueryTable
Dim pt As PivotTable, pc As PivotCache
NewPath As String
NewPath = [Path]
For Each sh In ActiveWorkbook.Sheets
For Each pt In sh.PivotTables
pt.SourceData = NewPath
Next pt
Next sh
MsgBox ("Done")
End Sub
Problem is, it seems that each and every pivot table now cashes the data source, meaning that my analysis sheet is growing to 100mb+ and increases by about 8mb with each pivot table I add.
Is there any way I can fix this?
Thanks
Karl
I'm using Excel 2007.
I have the following problem. I have 5 large data sheets (over 400,000 records each) that I want to analyse using various different sheets utilizing pivot tables. I want to update the input sheets periodically, and then just have the pivot tables in the analysis sheets change their data source.
To achieve this I run the following code to update the data source;
Option Explicit
Sub ChangeSource()
Dim sh As Worksheet, qy As QueryTable
Dim pt As PivotTable, pc As PivotCache
NewPath As String
NewPath = [Path]
For Each sh In ActiveWorkbook.Sheets
For Each pt In sh.PivotTables
pt.SourceData = NewPath
Next pt
Next sh
MsgBox ("Done")
End Sub
Problem is, it seems that each and every pivot table now cashes the data source, meaning that my analysis sheet is growing to 100mb+ and increases by about 8mb with each pivot table I add.
Is there any way I can fix this?
Thanks
Karl