title: VBA copy pivot table in the same sheet and use it
body: <p>Hi I am copying a pivot table I have on the same sheet and I would like to use the copied pivot table by changing some items. The problem is when I copy pivot table, how do i identify the new pivot table name to use it?</p>
  
  <p>My main goal is to create multiple pivot tables on the same worksheet. Pivot wizard does not let me do that. </p>
  
  <p>My Code: </p>
  
  <pre><code>        ws.Select
          TotalColumns = ws.Cells(1, Columns.Count).End(xlToLeft).Column 'Counting total columns
          TotalRows = ws.Range("A:A").Cells.SpecialCells(xlCellTypeConstants).Count 'Counting total rows
          Set PRange = ws.UsedRange 'found a new function to use do not need to use above fields, but keeping them just incase
          wsPivotStats.Select
          Set CreateStatsAppPt = wsPivotStats.PivotTableWizard(SourceType:=xlDatabase, SourceData:=PRange, TableDestination:=wsPivotStats.Range("B4"), TableName:="StatsPt1")
          Set StatsAppViewPt = wsPivotStats.PivotTables("StatsPt1")
  </code></pre>
  
  <p>Adding rows and columns to above table and...</p>
  
  <pre><code>   ActiveSheet.PivotTables("StatsPt1").PivotSelect "", xlDataAndLabel, True
     Selection.Copy
     wsPivotStats.Range("B22").Select
     wsPivotStats.Paste
     Set StatsRevViewPt = wsPivotStats.PivotTables("PivotTable2")
             StatsRevViewPt.Select
      With StatsRevViewPt.PivotFields(CaseClas)
                 .Orientation = xlColumnField
                 .Position = 1
                ' .Subtotals = Array(False, False, False, False, False, False, False, False, False, False, _
                  False, False)
      End With
  </code></pre>