Kamis, 26 Mei 2011

[ExcelVBA] Re: Refreshing Pivot Tables

 

Actually Sharron, it's not much extra code for David's first suggestion. I'd forgotten all about disabling events - shows you how often I write code for worksheet events. In any case, you just need to add some code before and after your line:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Sheets("Sheet1").PivotTables("PivotTable1").RefreshTable
Application.EnableEvents = True
End Sub

Dave Gathmann

--- In ExcelVBA@yahoogroups.com, Sharron Puryear <sheizageek@...> wrote:
>
> That sounds great. . . however, it's over my head.  Thanks for the info though.  I will try to look up all that you said and attempt this.
>  
> Sharron
>
> --- On Wed, 5/25/11, david braithwaite <dbraithwaite@...> wrote:
>
>
> From: david braithwaite <dbraithwaite@...>
> Subject: [ExcelVBA] Re: Refreshing Pivot Tables
> To: ExcelVBA@yahoogroups.com
> Date: Wednesday, May 25, 2011, 1:57 PM
>
>
>  
>
>
>
>
>
> It's a little tricky --- but often necessary when working with event
> handlers of this scope.
>
> You need to turn off events while in the _change event else anything you do
> with the screen will trigger another event.
>
> You could also set a static or module level variable to indicate that you
> are currently processing an event and others should be ignored.
>
> db
>
> [Non-text portions of this message have been removed]
>
>
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>

__._,_.___
Recent Activity:
----------------------------------
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