新足迹

 找回密码
 注册

精华好帖回顾

· 周末半日好去处 (2009-3-6) chinara · 游走的人生--回国4年经历和感悟(34楼更新,62楼完结篇) (2007-11-22) 落梅摇香
· 什么是教育的本质? --私校haileybury college- Brighton分校 参观记 (2015-5-2) kingkongfei · 美讶滴"深夜"私房小菜---P5考到绿P的开心家常晚餐 (2007-2-4) 美讶
Advertisement
Advertisement
查看: 956|回复: 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
返回顶部