【问题标题】:Getting Run time Error 5 when updating a Pivot Table更新数据透视表时出现运行时错误 5
【发布时间】:2014-01-19 13:42:14
【问题描述】:

我正在尝试更新数据透视表。以下代码在我的计算机上运行,​​但在我同事的计算机上显示Run time error 5 - invalid procedure call or argument。错误发生在.ChangePivotCache

Sheets("DB for ECO Qty").Activate
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
Sheets("ECO Qty over time Graph").Activate
DataArea = "DB for ECO Qty!R1C1:R" & LastRow & "C19"
Range("B4").Select
Application.DisplayAlerts = False
ActiveSheet.PivotTables("PivotTable1").ChangePivotCache ActiveWorkbook. _
PivotCaches.create(SourceType:=xlDatabase, SourceData:=DataArea, _
Version:=xlPivotTableVersion14)

Application.DisplayAlerts = True

【问题讨论】:

  • 你的同事运行的是什么版本的 Excel?

标签: vba pivot-table


【解决方案1】:

数据透视表对象在 Excel 2007 中确实得到了增强,因为在此之前它的方法非常有限。

很可能您的同事正在运行 Excel 2003,并且从这个 MSDN Reference 来看,该版本中似乎不存在 .ChangePivotCache 方法。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-04-03
    • 1970-01-01
    • 1970-01-01
    • 2016-03-09
    • 1970-01-01
    • 1970-01-01
    • 2013-07-02
    相关资源
    最近更新 更多