PivotCache.Refresh

G

Guest

Can anyone help with this error please, when I run the following statement in
my macro

ActiveSheet.PivotTables("DataPivot").PivotCache.Refresh


Runtime error 1004

Unable to get the PivotTable properties of the worksheet task
 
F

Ferris

Can anyone help with this error please, when I run the following statement in
my macro

ActiveSheet.PivotTables("DataPivot").PivotCache.Refresh

Runtime error 1004

Unable to get the PivotTable properties of the worksheet task

If there's one PivotTable on the sheet you can also use:
ActiveSheet.PivotTables(1).PivotCache.Refresh

If you want to verify the name you can use:
Debug.Print ActiveSheet.PivotTables(1).Name
 
G

Guest

I was getting the same message. I even tried recording a macro to refresh the
pivot table, but got the same code. It seemed to have worked in Excel 2003
but not in 2007.

I don't have much VBA experience, but when I changed the statement to be,
ActiveSheet.PivotTables("DataPivot").RefreshTable, the macro would continue
to run.

Hope this helps.

Kara
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top