|  | Clear data from pivot table |  | |
| | | Klemen25 |  |
| Posted: Wed Jun 18, 2008 12:25 pm Post subject: Clear data from pivot table |  |
Hello all.
Usually when building a pivot table report I throw the data sets in the pivot table a few times to find the best way to show data. So I wonder - is there a way to quickly erase all the data sets so the pivot table is again empty as just being created (so I do not have to select each data set and remove it? Macro or some other trick?
The closest I got to the answer was the idea to just create another pivot table from the original data…but it would be so much easier to click a button and all the data is cleared from the pivot table.
Thank you as always people! |
| |
| | | Debra Dalgleish |  |
| Posted: Wed Jun 18, 2008 12:25 pm Post subject: Re: Clear data from pivot table |  |
| |  | |
In Excel 2007 there's a Clear command on the PivotTable Options tab of the Ribbon. You could use a macro to clear the pivot table, in Excel 2003 or earlier. This examples clears the pivot table for the active cell. '==================== Sub ActiveCellClearPivot()
On Error Resume Next
Dim pt As PivotTable Dim pf As PivotField
Set pt = ActiveCell.PivotTable For Each pf In pt.VisibleFields pf.Orientation = xlHidden Next pf 'pt.RefreshTable
End Sub
'========================
Klemen25 wrote:
| Quote: | Hello all.
Usually when building a pivot table report I throw the data sets in the pivot table a few times to find the best way to show data. So I wonder - is there a way to quickly erase all the data sets so the pivot table is again empty as just being created (so I do not have to select each data set and remove it? Macro or some other trick?
The closest I got to the answer was the idea to just create another pivot table from the original data…but it would be so much easier to click a button and all the data is cleared from the pivot table.
Thank you as always people!
|
-- Debra Dalgleish Contextures LINK Blog: LINK |
| |
| | | Klemen25 |  |
| Posted: Wed Jun 18, 2008 2:03 pm Post subject: Re: Clear data from pivot table |  |
Great! Works like a charm. I had in mind to mention that I use Excel 2003 but it slipped my mind.
Thank you! |
| |
|
|