title: Updating DataSource of PivotTables via VBA, without creating new PivotCaches
body: <p>I have a workbook, where there is a RawData sheet and there are 8-9 other sheets that have pivot tables that read a table from RawData. The RawData changes daily, i.e. there can be more or less number of rows in the RawData sheet's table.</p>
  
  <p>Right now, I manually update DataSource property of each pivot table one each sheet using ChangeDataSource feature of Excel. However, this is painful. Crawling on web I found vba code to update all Pivot tables at once. I am not pasting the whole code, but it looks something like this. </p>
  
  <pre><code>ActiveSheet.PivotTables("PivotTable1").ChangePivotCache ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=&lt;RawData-AddressRange&gt;)
  </code></pre>
  
  <p>But what this code does is, it creates new pivot caches for each pivot table and increases the size of the file. However, I do not want the file size or number of pivot cache's to increase, but just change the dataSource of existing PivotTables/PivotCaches and refresh them.</p>