Pivot Table Help

W

Wike05

Im using pivot tables to make reports for my boss in excel. But she has no
idea how to use them so i recorded macros that set the different reports up
for her. The problem is i need the macro to clear the current layout in the
pivot
table before it applies the new layout.
 
R

robert111

Can you write a separate macro to do the clearing, and attach it to a
prominent button object that she can click before resetting.

Alternatively, put each pivot on a separate sheet and then all she
needs to do is open the required sheet.
 
W

Wike05

i only know how to record and do some minor editing of macros. but i cant
figure what i need to stick in the begining of the macro to have clear the
layout, then apply the new layout.
 
D

Debra Dalgleish

You can hide all the fields:

Sub ClearPivot()
Dim pt As PivotTable
Dim pf As PivotField
Set pt = ActiveSheet.PivotTables(1)

For Each pf In pt.PivotFields
pf.Orientation = xlHidden
Next pf

End Sub
 
Top