Have you tried the auto update assignments such as
<Private Sub Worksheet_Change(ByVal Target As Range)>
'then add your PT refresh code
<End Sub>
We included this in the object and not a separate module. I really didn't like
this because everytime you change a value on the worksheet it fires the code and
recalculates, and since I don't have the latest and greatest equipment this can
be time consuming.
________________________________
From: Sharron Puryear <sheizageek@yahoo.com>
To: ExcelVBA@yahoogroups.com
Sent: Tue, May 24, 2011 10:23:07 AM
Subject: Re: [ExcelVBA] Refreshing Pivot Tables
That's not exactly what I meant. I have seen a lot of code to refresh a pivot
table or all pivot tables, but none that explicitly refreshes on the same page
as the data source. I have tried several different codes but when I change data
in the data source, the pivot table does not refresh. You have to hit the
<enter> key to put your data in Excel, or the Green check mark on the formula
table. I just want to PT to refresh as I enter new data in the data source.
Thanks for the response though.
Sharron
--- On Tue, 5/24/11, L allen <loaa3406@yahoo.com> wrote:
From: L allen <loaa3406@yahoo.com>
Subject: Re: [ExcelVBA] Refreshing Pivot Tables
To: ExcelVBA@yahoogroups.com
Date: Tuesday, May 24, 2011, 9:42 AM
Sharron,
I'm not sure about setting up the [Enter] key but find your subject macro in the
macro list & assign a shortcut under the [Options...] tab, i.e. I use [Shift] +
[Ctrl] + [q] for a lot of routines that I run.
Loa
________________________________
From: sheizageek <sheizageek@yahoo.com>
To: ExcelVBA@yahoogroups.com
Sent: Mon, May 23, 2011 1:18:34 PM
Subject: [ExcelVBA] Refreshing Pivot Tables
I have an Excel 2007 worksheet that has Source Data and a PivotTable on the same
worksheet. I have VBA code that works well to refresh a pivot table that is on a
separate worksheet, but doesn't work if the pivot table is on the same
worksheet.
Is there a way for the pivot table to refresh when the <Enter> key is pressed
after the source data is changed?
This is the code I am using if the PT is on a separate worksheet.
Private Sub Worksheet_Calculate()
Sheets("Sheet1").PivotTables("PivotTable1").RefreshTable
End Sub
Thanks
Sharron
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar