PT.Format (xlTable2) removes data from pivot table?

M

mrscott

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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top