title: Linking slicers from PivotTables built with data model
body: <p>I have a couple of pivot tables that use different caches. All of these tables are created through data connections, and all utilize the data model. What I am trying to created master slicer that filters all of the tables simultaneously. </p>
  
  <p>Using VBA, my thinking is to populate an array of all the visible pivotitems from pivotcache1 (the cache that my master slicer is linked to), and then cycle through this array to filter my other caches (pivotcache2 &amp; pivotcache3). </p>
  
  <p>However, the below code does not work - it breaks down at the For Each loop. </p>
  
  <pre><code>Sub FilterMonth()
  
      Dim sc1, sc2, sc3 As SlicerCache
      Dim si As SlicerItem
  
      Set sc1 = ActiveWorkbook.SlicerCaches("Slicer_ClickMonth")
      Set sc2 = ActiveWorkbook.SlicerCaches("Slicer_Visit_Month1")
      Set sc3 = ActiveWorkbook.SlicerCaches("Slicer_Visit_Month")
  
      For Each si In sc1.SlicerItems
          If si.Selected Then
              'Add to my array
          End If
      Next 
  
  End Sub
  </code></pre>
  
  <p>I believe that this is because there the syntax is different for caches built on data models.  </p>
  
  <p>Can anybody confirm this and/or provide me with code to filter all of my datamodel caches?</p>