I have a macro as follows that collapses all row labels of the selected pivot table,
However - this does not work on a Powerpivot table.
What adjustments would be needed to make it work and can I have 1 macro that works on both regular and power pivots?
Code:
On Error Resume Next
Dim pt As PivotTable
Set pt = ActiveCell.PivotTable
With pt
.ManualUpdate = False
For i = 1 To .RowFields.Count
.PivotFields(.RowFields(i).Name).ShowDetail = False
Next i
.ManualUpdate = False
End With
However - this does not work on a Powerpivot table.
What adjustments would be needed to make it work and can I have 1 macro that works on both regular and power pivots?