数据透视表"RefreshTable"与“更新"方法 [英] Pivot Table "RefreshTable" vs "Update" methods

查看:571
本文介绍了数据透视表"RefreshTable"与“更新"方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以编程方式刷新 Excel工作簿的给定工作表中的所有数据透视表.在此处在StackOverflow上搜索后,我发现

I want to programmatically refresh all the Pivot Tables in a given Worksheet of my Excel Workbook. After searching here on StackOverflow, I found this question where the answer suggests using either

ThisWorkbook.RefreshAll

或类似的

Dim pivot As PivotTable

For Each pivot In Worksheets("MySheet").PivotTables
    pivot.RefreshTable
    pivot.Update
Next

由于我只想刷新给定工作表中的表,因此第一种方法不是我想要的.因此,我修改了第二种方法以满足我的需求.

As I only want to refresh the tables in a given sheet, the first method was not what I was looking for. Hence, I modified the second method to satisfy my needs.

我在这里的问题是PivotTable对象的RefreshTableUpdate方法之间有什么区别?我想如果我们同时使用它们,则意味着它们在某种程度上有所不同.

The question I have here is what's the difference between the RefreshTable and the Update methods of the PivotTable object? I guess if we are using both of them, it means they are different in some way.

在哪种情况下,为了节省时间,我们只能使用其中的一种,因为当数据透视表出现时,刷新更新会花费大量时间有很多数据吗?

In what situation can we use only one of them in order to save time, as it seems that refreshing and updating take a considerable amount of time when the pivot table has a lot of data?

推荐答案

根据

According to this article and a little testing, the distinction is basically this:

更新:更新单个数据透视表

Update: Update a single Pivot Table

刷新:使用相同的源数据更新所有数据透视表

Refresh: Update all PivotTables using the same source data

例如在Excel中使用相同外部数据库的所有数据透视表,或在Excel中使用相同数据表的所有数据透视表-例如如果您有两个数据表Data1和Data2,则使用Data1的数据刷新任何数据透视表,将使用Data1的数据刷新所有数据透视表.

RefreshAll:更新工作簿中的所有数据透视表

RefreshAll: Update all pivot tables in the workbook

这篇关于数据透视表"RefreshTable"与“更新"方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆