Sorting Page fields in PivotTable

T

Todd Huttenstine

The below code is supposed to sort each pivotfield in
pagefield by ascending order. I am getting the
error "Unbale to get the pivotfields property of the
PivotTable class" What is wrong with the code?

Dim PvtTable
Dim CurrentPageField
Set PvtTable = Worksheets("Wkly Renewals").PivotTables
("PivotTable4")
For Each pvtitem In PvtTable.PageFields
CurrentPageField = pvtitem.Name
ActiveSheet.PivotTables("PivotTable4").PivotFields
(pvtitem).AutoSort _
xlAscending, pvtitem
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top