KMacattack
New Member
- Joined
- Nov 24, 2008
- Messages
- 11
Is there a way to redefine the Sourcedata for each pivottable using VBA. I am trying to make sure that i can get the excel workbook as small as possible, i have a lot of pivot tables in the workbook.
so i would want something like this:
but I am getting an error.
Please help.
Thank you
so i would want something like this:
Code:
Sub PT_Update()
Dim sht As Worksheet
Dim PT As PivotTable
For Each sht In ActiveWorkbook.Sheets
For Each PT In sht.PivotTables
PT.PivotCache.SourceData = "PivotTable1"
Next
Next
End Sub
but I am getting an error.
Please help.
Thank you