excel数据透视表
If you have similar data on two or more worksheets, you might want to combine that data in a pivot table, to show the summarized results.
如果在两个或多个工作表上有相似的数据,则可能需要将该数据合并到数据透视表中以显示汇总结果。
Unfortunately, the pivot table from data on multiple sheets can be a disappointment.
不幸的是, 来自多张纸上数据的数据透视表可能会令人失望。
通过编程创建数据透视表 (Create a Pivot Table with Programming)
A couple of years ago, Excel MVP, Kirill Lapin (KL), shared a sample file that he created, with amendments by Hector Miguel Orozco Diaz.
几年前,Excel MVP Kirill Lapin(KL)分享了他创建的样本文件,并由Hector Miguel Orozco Diaz进行了修改。
It uses code to automatically create a pivot table from multiple sheets in a workbook.
它使用代码从工作簿中的多个工作表自动创建数据透视表。
You can read the details here: Create a Pivot Table from Multiple Sheets.
您可以在此处阅读详细信息: 从多个图纸创建数据透视表 。
修改后的解决方案 (Revised Solution)
Kirill's sample file was created as a conceptual prototype, and targeted advanced VBA users. The code has minimal error handling and compatibility checks.
Kirill的样本文件是作为概念性原型创建的,并针对高级VBA用户。 该代码具有最少的错误处理和兼容性检查。
However, the sample file was extremely popular, and Excel users at all skill levels wanted to adopt this solution in their own applications. To make things easier, Kirill has created a similar solution based on ADO.
但是,该示例文件非常受欢迎,并且所有技能水平的Excel用户都希望在自己的应用程序中采用此解决方案。 为了使事情变得容易,Kirill创建了一个基于ADO的类似解决方案。
优点: (Advantages:)
- No need for temporary file generation 无需临时文件生成
- The code is faster and less prone to errors 代码更快,更不容易出错
缺点: (Disadvantages:)
- No manual refresh of the PivotTable 没有手动刷新数据透视表
- Need to rebuild connection from the scratch to update the cache with new data 需要从头开始重建连接以使用新数据更新缓存
下载ADO示例文件 (Download the ADO Sample File)
You can download the new ADO version of the file from the Contextures website: PT0024 - Pivot Table from Multiple Sheets - ADO version.
您可以从Contextures网站上下载文件的新ADO版本: PT0024-“来自多个图纸的数据透视表-ADO版本”。
There is also a "Plug and Play" version of the file, at the same link. ________________
在同一链接上,还有文件的“即插即用”版本。 ________________
翻译自: https://contexturesblog.com/archives/2011/12/28/excel-pivot-table-from-multiple-sheets-update/
excel数据透视表