Hi Team,
I am unable to sort Grand Total of Pivot descending order. I am refreshing existing pivot.
and ensuring Grand total sorting is should be descending order.
Below is my attempted code which I am using.
Thanks
mg
I am unable to sort Grand Total of Pivot descending order. I am refreshing existing pivot.
and ensuring Grand total sorting is should be descending order.
Below is my attempted code which I am using.
VBA Code:
Sub test
Dim pt as pivottable
Dim pf as pivottable
Dim Key1 as range
Set pt = sht_Pivot.PivotTables(Pivot1)
Set pf = pt.PivotFields("[B]Sum of Outstanding Amount[/B]") 'Actual Data Field Name is Outstanding Amount
Set key1 = pf.DataRange.Cells(1, 1)
pf.DataRange.Sort key1, xlDescending
End sub
Thanks
mg
Attachments
Last edited: