Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Refreshing all pivot tables in workbook

Replace
pt.PivotCache.Refresh
with
pt.RefreshTable
--
HTH...

Jim Thomlinson


"klysell" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default Refreshing all pivot tables in workbook

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


"Jim Thomlinson" wrote:

Replace
pt.PivotCache.Refresh
with
pt.RefreshTable
--
HTH...

Jim Thomlinson


"klysell" wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default Refreshing all pivot tables in workbook

Hi Jim,

I integrated your code and the same thing happens. Excel is inoperable for
at least 20 minutes.... There has to be a reason why it practically hangs....
I'll post again tomorrow with the code.

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


"Jim Thomlinson" wrote:

Replace
pt.PivotCache.Refresh
with
pt.RefreshTable
--
HTH...

Jim Thomlinson


"klysell" wrote:

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Refreshing all pivot tables in workbook

I use

ActiveWorkbook.RefreshAll



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default Refreshing all pivot tables in workbook

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


"Jig" wrote:

I use

ActiveWorkbook.RefreshAll


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Refreshing Pivot Tables hnyb1 Excel Discussion (Misc queries) 1 September 13th 07 01:21 PM
When refreshing pivot tables my pivot table chart type changes hannah220507 Excel Discussion (Misc queries) 1 May 22nd 07 02:57 PM
Refreshing Pivot Tables in a Shared Workbook Pedro Excel Discussion (Misc queries) 1 February 12th 07 10:52 PM
Refreshing Pivot Tables in a Shared Workbook Pedro Excel Worksheet Functions 0 January 31st 07 09:41 PM
Refreshing pivot tables matpj[_47_] Excel Programming 0 March 20th 06 03:40 PM


All times are GMT +1. The time now is 02:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"