0
У меня есть таблица, которая выглядит, как этотИспользование FilterType: = xlValueIsGreaterThan в Excel 2016 VBA
Name Order Amount Location
Grace 120000 new jersey
Tom 200000 baltimore
Rick 5000000 hyderabad
Hari 600000 denver
Raj 4000000 Delhi
Victoria 300000 New York
Я создал стержень со всеми 3-х полей, но я не могу успешно использовать PivotFilters.Add FilterType: = xlValueIsGreaterThan
опция успешно ... что я не так с моим кодом?
Sub addFields()
With ActiveSheet.PivotTables(1)
'First row field
With .PivotFields("Name")
.Orientation = xlRowField
.Position = 1
End With
'Report Filter field
With .PivotFields("Location")
.Orientation = xlPageField
.Position = 1
End With
'Order Amount or numerical data in the Values field
.AddDataField ActiveSheet.PivotTables(1).PivotFields("Order Amount"), _
"Sum of Amount", xlSum
End With
With .PivotFields("Sum of Amount").PivotFilters.Add filterType:=xlValueIsGreaterThan DataField :="Sum of Amount" value1:=4000000
End With
End Sub