Developer technologies | Visual Basic for Applications
An implementation of Visual Basic that is built into Microsoft products.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
When I search for
PivotField.AutoSort
method: excel.pivotfield.autosort, there is a Parameter called CustomSubtotal.
Anyone have the sample, what should I put in for this parameter?
Here the sample table KH0d6.png
The main objective is use vba to autosort PivotTable based on "C Total".
I had tried both code below, cannot work.
With pvt
.PivotFields("Field 1").AutoSort(Order:=Excel.XlSortOrder.xlDescending, Field:="Field 2", CustomSubtotal:="C Total")
End With
With pvt
.PivotFields("Field 1").AutoSort(Order:=Excel.XlSortOrder.xlDescending, Field:="Field 2", CustomSubtotal:="C")
End With
Thanks.