Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 Excel 电子表格模板,其中包含具有指定电子表格内容的标准的数据透视表。
我需要通过在单独的电子表格中运行的宏以编程方式修改该标准,以便模板具有不同的内容。
什么编码适合实现这一目标?
下面的代码将更新单独工作簿中数据透视表上的报表过滤器。
在此示例中,报告过滤器名为“ Location ”,其值更改为“ West ”
该代码假定单独的工作簿已打开。
Sub UpdatePivotFilter() Workbooks("Book1.xls").Sheets("Sheet1").PivotTables("PivotTable1"). _ PivotFields("Location").CurrentPage = "West" End Sub