• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Pivot refresh - Message if the data source hasn't been changed

Villalobos

Active Member
Hello,

I would like to ask that how is it possible to check that the data source of pivot table really changed or not before this command running:
Code:
 Sheets("Sheet1").Range("B6").PivotTable.RefreshTable

My target is that to receive a message before the .PivotTable.RefreshTable if the data source has not been changed since the last fresh.

Any recommendation?



Thanks in advance!
 
Hi ,

Is the data source mere data or is it having formulae ? If it is the data will be changed , then you can use the Worksheet_Change event procedure to identify when any cell in the data source has been changed.

Narayan
 
Hello Narayan,

Thanks, you were helpful, I figured how to do it with Worksheet_Activate! :)

Code:
 Option Explicit
Private Sub Worksheet_Activate()
Application.EnableEvents = False
Dim p As PivotTable
For Each p In PivotTables
        p.RefreshTable
    Next p
Application.EnableEvents = True
End Sub
 
Last edited:
Back
Top