我正在尝试在VBA访问脚本中添加一个数据字段,该数据用于计算某个日期在某个日期被拨多少次。我已将列设置为返回“已拨电话号码和天数”,但是我无法在线找到正确的格式来为其他需要的列做.AddDataField。就是说我的.AddDataField函数需要一个'='符号。正确的格式是什么?
Set xlPT = xlPC.CreatePivotTable(xlSheet.Range("A3"), "Aux Code Report")
With xlPT
.AddDataField("Dialed_Mod_Num","DialedModTotal",xlCount)
With .PivotFields("Dialed_Mod_Num")
.Orientation = xlRowField
.Position = 1
.Caption = "DialedMOD_Num"
End With
With .PivotFields("LocalDay")
.Orientation = xlRowField
.Position = 2
.Caption = "Date"
End With
.TableStyle2 = "PivotStyleMedium2"
.RowAxisLayout 1
.InGridDropZones = True
.DisplayErrorString = True
End With
答案 0 :(得分:0)
尝试一下
.AddDataField .PivotFields("Dialed_Mod_Num"), "DialedModTotal", xlCount