title: excel not refreshing all pivot tables
body: <p>I am trying to refresh pivot tables using vba.<br>
  I have code that modifies the underlying table query, and refreshes the query.<br>
  Once that is done, it refreshes the pivot tables, which in turn will refresh a summary sheet. For some reason, the final pivot table is not being refreshed. It will refresh normally.</p>
  
  <p>Methods tried:</p>
  
  <p>1.</p>
  
  <pre><code>Dim PC As PivotCache
  For Each PC In ThisWorkbook.PivotCaches
      While DateDiff("s", PC.RefreshDate, Now) &gt; 60
      PC.Refresh
      Wend
  Next
  </code></pre>
  
  <p>2.</p>
  
  <pre><code>Sheets("Pivots").PivotTables("Pivot1").PivotCache.Refresh
  Sheets("Pivots").PivotTables("Pivot2").PivotCache.Refresh
  Sheets("Pivots").PivotTables("Pivot3").PivotCache.Refresh
  Sheets("Pivots").PivotTables("Pivot4").PivotCache.Refresh
  </code></pre>
  
  <p>3.</p>
  
  <pre><code>ThisWorkbook.RefreshAll
  </code></pre>
  
  <p>I have tried including a <code>DoEvents</code> before refreshing pivot tables, after the refresh of the tables has occurred.<br>
  I have also tried copying the file to another file, and recreating it there. the effect stays, it simply moves to whichever pivot table it considers the last one created.
  File size is 279Kb as xlsb, and 336 Kb as xlsm.<br>
  Data for the tables is coming from SQL server 2012, and all tables are on the same excel sheet. The tables are updated, but the pivot is not.</p>