I have the following macro to refresh all pivot tables in a workbook:
For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
MsgBox pt.Name
pt.RefreshTable
Next pt
Next ws
When I run the macro I get an error that
Run time error 1004
Cannot open PivotTable source file
The msgbox tells me that the offending table is PivotTable7 and tells me the source file that it is looking for which is a previous version of the current file. All of the data for the pivot tables in this workbook should be in this workbook so the error is probably a case where I had a current and old workbook open and accidently messed up the source assignment. Problem is - I can't find PivotTable7 in the current workbook. Any suggestions on how to find and delete it?
For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
MsgBox pt.Name
pt.RefreshTable
Next pt
Next ws
When I run the macro I get an error that
Run time error 1004
Cannot open PivotTable source file
The msgbox tells me that the offending table is PivotTable7 and tells me the source file that it is looking for which is a previous version of the current file. All of the data for the pivot tables in this workbook should be in this workbook so the error is probably a case where I had a current and old workbook open and accidently messed up the source assignment. Problem is - I can't find PivotTable7 in the current workbook. Any suggestions on how to find and delete it?