title: VBA Pivot Table Range change
body: <p>I have a <code>PivotTable</code> that it's range and data always changes I have the below data:</p>
  
  <pre><code>Range("A3").Select
  Selection.CurrentRegion.Select
  DataArea = "Sheet21!R1C1:R" &amp; Selection.Rows.Count &amp; "C" &amp; Selection.COLUMNS.Count
  ActiveSheet.PivotTables("PivotTable7").ChangePivotCache ActiveWorkbook. _
          PivotCaches.Create(SourceType:=xlDatabase, SourceData:=DataArea, _
          Version:=xlPivotTableVersion15)
  </code></pre>
  
  <p>I'm getting an error</p>
  
  <blockquote>
    <p>Unable to get the PivotTables property of the Worksheet class</p>
  </blockquote>