Hi,
I have multiple pivots in a spreadsheet contained within numerous worksheets. Each quarter I update my data by adding data within an additional column to the right of my existing data. The pivot tables only show the last 8 quarters of the existing data. At present I manually change the datafields of all the pivots so that only the last 8 quatrters are visible and then I refresh the pivot to obtain the data. I would like some code to automate this process.
The following code is my attempt:
The problem I am having relates to the line of code below:
PT.PivotTableWizard SourceType:=xlDatabase, SourceData:=rng
I am receiving the following error message:
'Run time error 1004'
Application-defined or object-defined error
The object "rng" which is providing the source data should update everytime some additional data is added to my existing array and therefore the pivot table and the datafields which are visible should also update.
Can anyone help?
Bookmarks