Try sticking your line in the
Worksheet_SelectionChange(ByVal Target As Range) event. I myself am not a fan of this kind of action since one seems to lose the option of Undoing entries.
Dave Gathmann
--- In ExcelVBA@yahoogroups.com, Sharron Puryear <sheizageek@...> wrote:
>
> 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@...> wrote:
>
>
> From: L allen <loaa3406@...>
> 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@...>
> 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]
>
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