在数据透视表VBA模块中设置功能属性

时间:2018-10-17 21:21:35

标签: function properties access-vba pivot-table

我试图将数据透视表功能设置为该字段的总和。下面是我的大部分代码,我不明白为什么它无法设置此功能。我在代码末尾遇到了“ 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

0 个答案:

没有答案