1. the sort order seems to be manual
2. I like the PT wizard method since I think it's easier and clearer to use
Option Explicit
Sub Macro4()
Dim pt As PivotTable
'expression.PivotTableWizard( _
' SourceType, SourceData, TableDestination, TableName,
' RowGrand, ColumnGrand, SaveData, HasAutoFormat,
' AutoPage, Reserved,
' BackgroundQuery, OptimizeCache, PageFieldOrder, PageFieldWrapCount, ReadData, Connection)
Set pt = Worksheets("Summary").PivotTableWizard( _
xlDatabase, Sheets("Raw data").Range("A1").CurrentRegion, Worksheets("Summary").Range("A4"), "SummaryPT", _
False, True, True, False)
With pt
With .PivotFields("Credit analyst")
.Orientation = xlRowField
.Position = 1
.PivotItems("James").Position = 1
.PivotItems("danny").Position = 2
.PivotItems("ramu").Position = 3
.PivotItems("Hudson").Position = 4
.PivotItems("Jack").Position = 5
.PivotItems("Maddy").Position = 6
End With
.AddDataField .PivotFields("Overdue Total"), "Sum of Overdue Total", xlSum
.AddDataField .PivotFields("90+"), "Sum of 90+", xlSum
.PivotFields("Data").Orientation = xlColumnField
.PivotFields("Sum of Overdue Total").NumberFormat = "$#,##0.00_);([red]$#,##0.00)"
.PivotFields("Sum of 90+").NumberFormat = "$#,##0.00_);([red]$#,##0.00)"
.TableRange2.EntireColumn.AutoFit
End With
End Sub