更改所有数据透视表的数据源

本文介绍了如何更改单个或所有Excel数据透视表的数据源。对于单个表格,可以通过功能区的命令更改;若要批量更改,可以使用宏自动化操作。文中还提供了在Contextures网站上的样本代码资源。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

If you want to change the data source for a single Excel Pivot Table, you can use a command on the Ribbon. If you want to change data source for all pivot tables in a workbook, you can use a macro, instead of making the changes manually.

如果要更改单个Excel数据透视表的数据源,则可以在功能区上使用命令。 如果要更改工作簿中所有数据透视表的数据源,则可以使用宏,而不是手动进行更改。

更改数据源一个数据透视表 (Change Data Source One Pivot Table)

Follow these steps, to change the data source for a single pivot table.

请按照下列步骤操作,以更改单个数据透视表的数据源。

  • Select a cell in the pivot table that you want to change

    在数据透视表中选择要更改的单元格
  • On the Ribbon, under PivotTable Tools, click the Options tab

    在功能区上,在“数据透视表工具”下,单击“选项”选项卡
  • Click the upper part of the Change Data Source command

    单击“更改数据源”命令的上部
datasourcechange02
  • When the Change PivotTable Data Source dialog box opens, press the F3 key on the keyboard, to open the Paste Name window.

    当“更改数据透视表数据源”对话框打开时,按键盘上的F3键以打开“粘贴名称”窗口。
  • Click on the named range that you want to use, and click OK

    单击您要使用的命名范围,然后单击“确定”。
datasourcechange03
  • Click OK to close the Change PivotTable Data Source dialog box.

    单击“确定”关闭“更改数据透视表数据源”对话框。

更改工作簿中的所有数据透视表 (Change All the Pivot Tables in the Workbook)

If you have several pivot tables in a workbook, and want to change all of them to a new data source, you can use a macro, instead of making the changes manually.

如果工作簿中有多个数据透视表,并且想要将它们全部更改为新的数据源,则可以使用宏,而不是手动进行更改。

I've added a new page on the Contextures website – Excel Pivot Table Data Source – with sample code to update all the pivot tables.

我在Contextures网站上添加了一个新页面– Excel数据透视表数据源 –带有示例代码来更新所有数据透视表。

The macro adds a sheet to your active workbook, showing a list of the file's named ranges. Then, the macro prompts you to enter one of those names, as the new data source for all the pivot tables.

该宏将一个工作表添加到您的活动工作簿中,显示该文件的命名范围的列表。 然后,宏提示您输入这些名称之一,作为所有数据透视表的新数据源。

datasourcechange01

翻译自: https://contexturesblog.com/archives/2012/04/19/change-data-source-for-all-pivot-tables/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值