Changing Pivot Filter Values in Excel 2013 in VBA Code

lgkartik

New Member
Joined
Jul 30, 2015
Messages
15
Hi All, I am trying to set a filter value to a pivot to be a constant when there is no real data in the pivot datasource.

The VBA code is as below -


ActiveSheet.PivotTables("PT01").PivotFileds("FIELD01").PivotFilters.Add Type:=[FONT=&quot]xlCaptionEquals[/FONT], Value1:="FIELDVAL"

I am getting the error " Object does not support this property or method"

As an alternative I tried

ActiveSheet.PivotTables("PT01").PivotFields("FIELD01"). _
ClearAllFilters

ActiveSheet.PivotTables("PT01").PivotFields("FIELD01"). _
PivotFilters.Add _
Type:=[FONT=&quot]xlCaptionEquals[/FONT], Value1:="FIELDVAL"

The code executes till ClearAllFilters. Thereafter I get an Applicaton defined or object defined error


Please advise. Thanks
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Dear members, any help would be highly appreciated.

Hope I am clear in my problem statement?

Thanks
Karthik L G
 
Upvote 0

Forum statistics

Threads
1,223,912
Messages
6,175,340
Members
452,638
Latest member
Oluwabukunmi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top