I am working on automating a report that pulls credit card spend transaction data, organizes transaction data by approving manager, makes pivot tables from that data, copies the pivot table and underlying data to a new sheet, resets the pivot table source to the data on the new sheet, then saves and closes the new sheet with the pivot table and data that was copied from the source sheet.
I am running into a problem where when the new workbook is opened when the user is trying to change a filter Excel shows an error that the table was saved without the underlying data.
I have tried to have the script open the new sheet (after previously closing it), refreshing the data, then closing and saving it, but that doesn't seem to solve the problem.
Is there a way that I can insert a private sub into the new workbook that runs when the workbook is opened that refreshes the pivot table data to avoid the error?
Thanks in advance for any help.
Bookmarks