新足迹

 找回密码
 注册

精华好帖回顾

· dorin小咪苦心钻研半年的经典面包机配方,包管易做好吃! (2010-5-13) dorin · 【2楼详细做法+30张高清大图完美诠释】❤❤只为那一碗销魂的重庆豌杂面❤❤ (2013-11-13) 航迹云
· 安居乐业之买房记 (2006-5-16) sail · 平凡之路----塔斯马尼亚自驾:看得见的风景 (2014-8-18) autrant
Advertisement
Advertisement
查看: 957|回复: 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
返回顶部