我试图将数据透视表功能设置为该字段的总和。下面是我的大部分代码,我不明白为什么它无法设置此功能。我在代码末尾遇到了“ Count_PONumber”和“ OverdueScheduleStatus”枢纽字段的问题。
With xlPT
.PivotFields("CalendarDay").Orientation = xlPageField
.PivotFields("FiscalWeekNumber").Orientation = xlPageField
.PivotFields("Manager").Orientation = xlPageField
.PivotFields("Supervisor").Orientation = xlPageField
.PivotFields("SalesID").Orientation = xlPageField
.PivotFields("Employee").Orientation = xlRowField
With .PivotFields("Count_PONumber")
.Orientation = xlDataField
.Function = xlSum
.Position = 1
.Caption = "Sum of PO_Numbers"
End With
With .PivotFields("OverdueScheduleStatus")
.Orientation = xlDataField
.Function = xlSum
.Position = 1
.Caption = "Overdue Schedule Status"
End With
.TableStyle2 = "PivotStyleMedium2"
.RowAxisLayout 1
.InGridDropZones = True
.DisplayErrorString = True
End With