Pivot Table Refresh

B

BJ

I would like to refresh all pivot tables within a specific worksheet. I am
trying to use the 'RefreshAll' function but I'm getting a 'Run-time error
'438' - Object doesn't support this property or method' error message.

I am using the statement

ActiveSheet.RefreshAll

Is this not a possible combination? I've tried changing it to
'ActiveWorksheet' with the same result. If I use 'ActiveWorkbook' it works,
but I only want to update a specific sheet.

thanks.

BJ
 
D

Debra Dalgleish

You can loop through the pivot tables on the worksheet:

Dim pt As PivotTable
For Each pt In ActiveSheet.PivotTables
pt.PivotCache.Refresh
Next pt
 
B

BJ

Thanks Debra - I was able to co-opt your language from another post but was
just curious to know if there was a 'simpler' way to program what I wanted to
do. Maybe not. Thank you for your help. Thank you also for your website -
you're tips have helped me out of many a jam.

Brett
 
D

Debra Dalgleish

You're welcome Brett, and thanks for letting me know that the tips on my
website have helped you.

There's no simpler way that I know of. RefreshAll can be used on the
workbook, but not the worksheet.
 

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