Hello Everyone,
I've been tasked with automating an Excel 2013 report that uses pivot tables. So far it's working except when I get to refreshing the pivot tables.
Now what happens is whenever a new report needs to be run, the data in the old report is cleared out of the Data Tab (except for the headers) and the new data that's been generated is put in it's place. Unfortunately whenever I run the following code:
I get an error message that says the pivot table needs more than 1 row of data in order to refresh. This causes me to have to go in manually and resize the data for the pivot table so that it will refresh the report properly.
I've been looking around online and I can't seem to find anything that tells me how I can automatically resize the data in a pivot table using VBA so I was wondering if you guys had any ideas. Or if you think there's a better method of going about all this, then I'm all ears.
Any assistance you guys can provide will be greatly appreciated.
Travis
Charter Media
I've been tasked with automating an Excel 2013 report that uses pivot tables. So far it's working except when I get to refreshing the pivot tables.
Now what happens is whenever a new report needs to be run, the data in the old report is cleared out of the Data Tab (except for the headers) and the new data that's been generated is put in it's place. Unfortunately whenever I run the following code:
Code:
Sheets("13 Week Avail Report").PivotTables("PivotTable1").RefreshTable
I get an error message that says the pivot table needs more than 1 row of data in order to refresh. This causes me to have to go in manually and resize the data for the pivot table so that it will refresh the report properly.
I've been looking around online and I can't seem to find anything that tells me how I can automatically resize the data in a pivot table using VBA so I was wondering if you guys had any ideas. Or if you think there's a better method of going about all this, then I'm all ears.
Any assistance you guys can provide will be greatly appreciated.
Travis
Charter Media