Sort PivotTable VBA
<p><strong>OBJECTIVE</strong></p>

<p>Sort Pivot Table Values by Descending order.</p>

<p><strong>APPROACH</strong></p>

<ol>
<li>Delete previous PivotTable (<code>PIVOT</code>)</li>
<li>Set up new PivotTable location (<code>target</code>)</li>
<li>Create PivotCache (<code>pvtCache</code>)</li>
<li>Deply PivotTable (<code>pvt</code>)</li>
<li>Add PivotTable Fields (<code>pvt.PivotFields(_)</code>)</li>
<li><strong>ISSUE: Sort PivotTable field (<code>PivotField("Base Expense")</code>) in descending order</strong></li>
</ol>

<p><strong>CODE</strong></p>

<pre><code>Sub createPivot()

Dim ws As Worksheet
Dim pvtCache As pivotCache
Dim pvt As pivotTable
Dim srcData As String
Dim lastRow As Long
Dim startPvt As String
Dim target As Worksheet

'Delete previous pivottable
Worksheets("PIVOT").PivotTables("PivotTable1").TableRange2.Clear


'Select pivot table data
Worksheets("CONSOLIDATED").Activate
Set ws = ActiveSheet
lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
srcData = ActiveSheet.Name &amp; "!" &amp; Range("A1:H" &amp; lastRow).Address(ReferenceStyle:=xlR1C1)

'Set pivot table location
Set target = ThisWorkbook.Worksheets("PIVOT")
startPvt = target.Name &amp; "!" &amp; target.Range("A1").Address(ReferenceStyle:=xlR1C1)

'Create pivot cache
Set pvtCache = ActiveWorkbook.PivotCaches.Create( _
    SourceType:=xlDatabase, _
    SourceData:=srcData)

'Deploy pivot table
Set pvt = pvtCache.CreatePivotTable( _
    TableDestination:=startPvt, _
    TableName:="PivotTable1")

    'Add Pivot Fields
    pvt.PivotFields("Fiscal Year").Orientation = xlColumnField
    pvt.PivotFields("Fiscal Year").Position = 1

    pvt.PivotFields("Fiscal Month").Orientation = xlColumnField
    pvt.PivotFields("Fiscal Month").Position = 2

    pvt.PivotFields("Unit").Orientation = xlRowField
    pvt.PivotFields("Unit").Position = 1

    pvt.PivotFields("Project").Orientation = xlRowField
    pvt.PivotFields("Project").Position = 2

    pvt.PivotFields("Base Expense").Orientation = xlDataField

   'Sort by largest !!!ERROR!!!
    pvt.PivotField("Base Expense") _
        .AutoSort xlDescending, "Base Expense" 

End Sub
</code></pre>

<p><strong>ERROR</strong></p>

<blockquote>
  <p>"Object doesn't support this property or method"</p>
</blockquote>

<p>@ Line</p>

<pre><code> 'Sort by largest !!!ERROR!!!
    pvt.PivotField("Base Expense") _
        .AutoSort xlDescending, "Base Expense" 
</code></pre>

<p><strong>QUESTIONS</strong></p>

<ol>
<li>Unsure why this error is being thrown. I've searched documentation that leads me to believe this should work (<a href="https://msdn.microsoft.com/en-us/library/office/ff834371.aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/office/ff834371.aspx</a>) <em>NOTE: ActiveSheet != to the sheet the pivot table is on, but I dont think that should create an issue here</em></li>
<li>Any recommendations on code-refactoring is appreciated.</li>
</ol>