Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Auto Refresh a Pivot Table

How do I get a Pivot Table to automatically refresh when the data source (in
the spreedsheet) is refresh.

I am refreshing the data source from the value of a cell on the same sheet
if that helps?

Tia
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default Auto Refresh a Pivot Table

Jonathan

You could use the change of the cell to trigger a refresh. The code below
should give you a start.

It uses the worksheet_Change event, checking that the cell that changes is
A2. If it is, it switches events off as the refresh will set another
firing, it refreshes a pivot table called PivotTable2 and then switches
events back on. make sure you switch this back on, probably by adding error
checking to do this. If the refresh is successful it returns True. (You may
not need this though)

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("A2")) Is Nothing Then
Application.EnableEvents = False
Me.PivotTables("PivotTable2").RefreshTable
End If
Application.EnableEvents = True
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Jonathan" wrote in message
...
How do I get a Pivot Table to automatically refresh when the data source
(in
the spreedsheet) is refresh.

I am refreshing the data source from the value of a cell on the same sheet
if that helps?

Tia



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Auto Refresh a Pivot Table

Hi Nick,

Thanks for the info but I think I didn't explain myself properly I don't
want the Pivot Table to refresh based on the value of a cell I want the pivot
table to refresh itself autmatically after the ODBC has been refreshed, does
that make more sense?

Regards


Jonathan

"Nick Hodge" wrote:

Jonathan

You could use the change of the cell to trigger a refresh. The code below
should give you a start.

It uses the worksheet_Change event, checking that the cell that changes is
A2. If it is, it switches events off as the refresh will set another
firing, it refreshes a pivot table called PivotTable2 and then switches
events back on. make sure you switch this back on, probably by adding error
checking to do this. If the refresh is successful it returns True. (You may
not need this though)

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("A2")) Is Nothing Then
Application.EnableEvents = False
Me.PivotTables("PivotTable2").RefreshTable
End If
Application.EnableEvents = True
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Jonathan" wrote in message
...
How do I get a Pivot Table to automatically refresh when the data source
(in
the spreedsheet) is refresh.

I am refreshing the data source from the value of a cell on the same sheet
if that helps?

Tia




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
Auto refresh pivot table Lori Excel Discussion (Misc queries) 1 February 18th 09 11:23 PM
auto refresh pivot table [email protected] Excel Discussion (Misc queries) 0 October 15th 08 03:17 AM
Auto refresh pivot table Eleanor M Excel Discussion (Misc queries) 3 September 12th 06 08:54 PM
auto refresh of pivot table Luc Poppe Excel Discussion (Misc queries) 9 September 10th 05 06:02 PM
Auto Refresh Pivot Table chris6562[_2_] Excel Programming 0 October 27th 04 09:36 PM


All times are GMT +1. The time now is 02:52 AM.

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

About Us

"It's about Microsoft Excel"