View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
marcus[_3_] marcus[_3_] is offline
external usenet poster
 
Posts: 140
Default Remove all column and row fields from a pivot table

Hi Takuto

This will remove all the items in your pivot table so you have a blank
table. Ready to populate with new information.

Take care

Marcus

Sub RemovePTItems()
'Removes all items in pivot table
Dim pt As PivotTable
Dim i As Integer

Set pt = ActiveSheet.PivotTables(1)
i = pt.PivotFields.Count

For Count = 1 To i
On Error Resume Next
pt.PivotFields(Count).Orientation = xlHidden
Next Count

End Sub