ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   PT.Format (xlTable2) removes data from pivot table? (https://www.excelbanter.com/excel-programming/352566-pt-format-xltable2-removes-data-pivot-table.html)

mrscott

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,



All times are GMT +1. The time now is 01:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com