Goodday all,
I am trying to move a PivotItem to the last position in my Pivot table and found on the web below VBA code, but it doesn't work
.
Does anybody have an idea why?
Dim total As Integer
total = ActiveSheet.PivotTables("PivotTable1").PivotFields("Vehicle Type Code").PivotItems.Count
ActiveSheet.PivotTables("PivotTable1").PivotFields("Vehicle Type Code").PivotItems("TRUCK").Position = total
I am trying to move a PivotItem to the last position in my Pivot table and found on the web below VBA code, but it doesn't work

Does anybody have an idea why?
Dim total As Integer
total = ActiveSheet.PivotTables("PivotTable1").PivotFields("Vehicle Type Code").PivotItems.Count
ActiveSheet.PivotTables("PivotTable1").PivotFields("Vehicle Type Code").PivotItems("TRUCK").Position = total