VBA Pivot Table Error
<p>I am trying to create a pivot table with VBA but am getting Runtime Error '13' Type mismatch</p>

<p>I have tried several different solutions to this issue, but nothing seems to work. </p>

<p>My data is a roster with over 80,000 rows. I want to be able to apply the VBA code to different rosters that will have different row counts. There may already be a pivot table in the workbook, so I want to create a new pivot cache to make sure that it does not interfere with the other pivot table if one exists or that it won't pull from a cache that does not exist. </p>

<p>After I open my workbook, my code is as follows: </p>

<pre><code> Sheets.Add
        ActiveSheet.Name = "Pivot Table"
        Sheets("Roster").Activate

    ActiveWorkbook.PivotCaches.Create _
    (SourceType:=xlDatabase, SourceData:=ActiveSheet.UsedRange,Version:=xlPivotTableVersion14) _
    .CreatePivotTable TableDestination:="Pivot Table!R3C1", DefaultVersion:= _
    xlPivotTableVersion14
</code></pre>

<p>Thanks for the help</p>