Hello,
I use code to gather data, create pivot tables, and assess the data. I exclude certain "Account" ("Account" is the column header) data criteria on certain pivot tables. For example, if any pivot table row field under "Account" contains "XXX", I remove XXX from the pivot table by filtering out XXX.
Frequently, XXX is the only "Account" in the data table, meaning there are no other accounts and the only relevant data falls under XXX. So, when the VBA code is ran, it executes but an error message pops up. I know this error is occurring because, on these certain occasions, I'm filtering out the only data in the table.
Since it's not possible to filter out all data within a pivot table, I tried hard coding zeros in the rows/columns of the data tables so the pivot tables could have a dummy value to reference. This works, but other formulas/functions/areas in my spreadsheet get messed up. I would like to find another way to handle the issues of filtering out the only data in a pivot table.
Please advise. Thanks!
I use code to gather data, create pivot tables, and assess the data. I exclude certain "Account" ("Account" is the column header) data criteria on certain pivot tables. For example, if any pivot table row field under "Account" contains "XXX", I remove XXX from the pivot table by filtering out XXX.
Frequently, XXX is the only "Account" in the data table, meaning there are no other accounts and the only relevant data falls under XXX. So, when the VBA code is ran, it executes but an error message pops up. I know this error is occurring because, on these certain occasions, I'm filtering out the only data in the table.
Since it's not possible to filter out all data within a pivot table, I tried hard coding zeros in the rows/columns of the data tables so the pivot tables could have a dummy value to reference. This works, but other formulas/functions/areas in my spreadsheet get messed up. I would like to find another way to handle the issues of filtering out the only data in a pivot table.
Please advise. Thanks!
Last edited: