Using VBA code, I have created a Pivot table and then added row, columns and values.Now I need to add filters. Can you please let me know how can I add filters?
使用VBA代码,我创建了一个Pivot表,然后添加了行,列和值。现在我需要添加过滤器。你能否告诉我如何添加过滤器?
I have a VBA code that need to loop over Pivot Table with filters. so far:
我有一个VBA代码,需要使用过滤器循环数据透视表。至今:
'Add item to the Report Filter- chose the filter that you want
pvt.PivotFields("DB").Orientation = xlPageField
'Position Item in list
pvt.PivotFields("DB").Position = 1
Any help will be much appreciated!
任何帮助都感激不尽!
1 个解决方案
#1
0
Here's how to add filter to a pivot table that I know of.
以下是如何将过滤器添加到我知道的数据透视表中。
Dim pvt As PivotTable
Set pvt = ActiveSheet.PivotTables("PivotTable1")
'Adds to the Report Filter
pvt.PivotFields("DB").Orientation = xlPageField
'Adds to the Column Labels
pvt.PivotFields("DB").Orientation = xlColumnField
'Adds to the Row Labels
pvt.PivotFields("DB").Orientation = xlRowField
#1
0
Here's how to add filter to a pivot table that I know of.
以下是如何将过滤器添加到我知道的数据透视表中。
Dim pvt As PivotTable
Set pvt = ActiveSheet.PivotTables("PivotTable1")
'Adds to the Report Filter
pvt.PivotFields("DB").Orientation = xlPageField
'Adds to the Column Labels
pvt.PivotFields("DB").Orientation = xlColumnField
'Adds to the Row Labels
pvt.PivotFields("DB").Orientation = xlRowField