新足迹

 找回密码
 注册

精华好帖回顾

· [美食接龙]第4棒: tritri之经典美味吮指虾 - 接棒食材- 蒜- tintin1976请接棒 (2009-6-6) tritri · 房屋维护、维修经验交流 (2009-6-7) Perth
· 错过的收获(小马照片来啦) (2005-2-26) bandf · I Got It: IT Position (2005-5-6) song
Advertisement
Advertisement
查看: 921|回复: 1

[学习培训] macro 问题 [复制链接]

发表于 2013-12-10 18:06 |显示全部楼层
此文章由 roseinsummer 原创或转贴,不代表本站立场和观点,版权归 oursteps.com.au 和作者 roseinsummer 所有!转贴必须注明作者、出处和本声明,并保持内容完整
请大家帮看一下下面这个routine的问题在哪里,系统说有object defined error, 但是我找不出来。

ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
        "Sheet1!R1C1:R3122C13", Version:=xlPivotTableVersion14).CreatePivotTable _
        TableDestination:="Sheet2!R1C1", TableName:="PivotTable4", DefaultVersion _
        :=xlPivotTableVersion14
Advertisement
Advertisement

发表于 2013-12-11 14:52 |显示全部楼层
此文章由 roseinsummer 原创或转贴,不代表本站立场和观点,版权归 oursteps.com.au 和作者 roseinsummer 所有!转贴必须注明作者、出处和本声明,并保持内容完整
ok, I have known what went wrong. I state the problem here for those who may have this problem and don't know what to do. The routine is to create a new pivot table on an existing sheet.  But if it is rerun again for updated data source, another new pivot table will be created with a different name, e.g. PivotTable 5. The name is different from the current name-PivotTable 4. So when you need to update the pivot table with the updated data, you have to do is to create an update routine.  This will solve the problem.  Hope it helps.

发表回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Advertisement
Advertisement
返回顶部