新足迹

 找回密码
 注册

精华好帖回顾

· 生命是一份礼物- 捐赠卵子的亲身经历 (2008-5-2) cl2007 · 老陶家常菜 (一) (2010-1-28) 老陶
· The Grampians National Park三日游(攀岩+爬山真人兽+6楼视频)(填坑完毕) (2009-12-29) edith921 · 看看今天的大碗菜 (2009-4-16) tinanakoo
Advertisement
Advertisement
查看: 909|回复: 1

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

发表于 2013-12-10 17: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 13: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
返回顶部