View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
mrscott mrscott is offline
external usenet poster
 
Posts: 1
Default PT.Format (xlTable2) removes data from pivot table?

Haha! I think I found the question but I need help with the answer.

The code snippet below is part of an advanced filter that I'm putting into a
pivot table.

Code:
'Set up PT data fields
With PT.PivotFields("CallStatus")
.Orientation = xlDataField
.Function = xlCount
.Position = 1
End With

PT.ManualUpdate = False 'calculates and draws the pivot table
PT.ManualUpdate = True 'turns off PT calculation

'Change RecvdDate from daily to quarterly in Pivot Table
PT.PivotFields("RecvdDate").LabelRange.Group Start:=True, _
End:=True, Periods:= _
Array(False, False, False, False, True, True, False)

'Row and column headings
PT.AddFields RowFields:=Array("Category", "Quarters", "RecvdDate"),
ColumnFields:="CallStatus"

PT.ManualUpdate = False
PT.ManualUpdate = True

WSN.Columns.AutoFit
PT.Format (xlTable2)



I discovered that Code:
PT.Format (xlTable2)
removes the data from the pivot table that was placed by Code:
..Orientation = xlDataField
, but I haven't a clue as to why.

If I comment out Code:
'PT.Format (xlTable2)
this part the data in the Pivot table stays.

Ideas anyone?

Thanks,