Download the featured file and code here: [ Ссылка ]
Here's the code:
Private Sub Worksheet_Change(ByVal Target As Range)
Sheet4.PivotTables("PivotTable3").PivotCache.Refresh
End Sub
In this video, I demonstrate how to automatically update a PivotTable when its data source changes. The data source would change when new records are added or existing records are changed. A completely new data source may also be specified for a PivotTable.
I also explain how housing your data in an Excel table makes it easier to update your PivotTable's data source.
Finally, I provide a way of automatically updating a PivotTable when its data source changes using a VBA Macro. This macro uses the worksheet 'change' event to update the pivot cache. Here is the code featured in the video:
------------------------
![](https://i.ytimg.com/vi/m9OX3mTEKfE/mqdefault.jpg)