View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
klysell klysell is offline
external usenet poster
 
Posts: 146
Default Refreshing all pivot tables in workbook

Hi,

I'm trying to programmatically update all pivot tables in my workbook
without referring any one in particular.

The code that I have so far isn't working. Here is the code:

For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
pt.PivotCache.Refresh
Next pt
Next ws

What am I doing wrong? When I run this code, it virtually freezed my file.
Eventually after an hour I believe it might work, but I was wondering if
there was more efficient code to do the trick.

Thanks,
Kent.
--
Kent Lysell
Financial Consultant
Ottawa, Ontario
W: 613.948-9557