TheRedCardinal
Board Regular
- Joined
- Jul 11, 2019
- Messages
- 243
- Office Version
- 365
- 2021
- Platform
- Windows
My macro works like this:
When I attempt to refresh the Pivot, the data source there is linking to the file "Model Workbook" and the old cell range that made up PivotData rather than the PivotData range in the existing workbook.
The Sub crashes because it can't access that range.
Other than a process to create a whole new pivot table (which I could do but seems unnecessary), is it possible to modify the way the Pivot Table is refreshing inside the new workbook?
- Source workbook has a procedure that copies a table from it, into an existing template file called "Model Workbook"
- In the model workbook is a pivot table, whose data source is a named range called "PivotData"
- The model workbook is then saved using a filename depending on the parameters of the file itself
- The table is modified by the user and when happy, clicks a button called refresh
- Refresh calls a Sub that checks the table in various ways and then labels the whole range "PivotData"
- The idea being that then when the PivotTable is refreshed, it brings in the new data instead of the old
When I attempt to refresh the Pivot, the data source there is linking to the file "Model Workbook" and the old cell range that made up PivotData rather than the PivotData range in the existing workbook.
The Sub crashes because it can't access that range.
Other than a process to create a whole new pivot table (which I could do but seems unnecessary), is it possible to modify the way the Pivot Table is refreshing inside the new workbook?