Filter Pivot table error

vikny11

New Member
Joined
Oct 27, 2013
Messages
15
Hi,

I am trying to filter a pivot table field named ("id") with ID="xyz". Below is the code I am using however I am getting a application or object defined error. Please let me know how to fix this error. Thanks for your help.


Sub filter()

With Worksheets("xyz").PivotTables(1)

.PivotFields("id").PivotFilters.Add Type:=xlCaptionEquals, Value1:="B10059"

End With

End Sub
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Where is the id field located in the table?
 
Upvote 0
Works fine for me as long as that value exists. If it doesn't I get that error.
 
Upvote 0
the data for this pivot comes from a closed workbook on the Sharepoint site. Can that be a reason for the error?
 
Upvote 0
Also, the pivot table is copied from Excel 2003 workbook into an excel 2010 workbook. The data source for this workbook is in Excel 2003 and VBA code for filtering the pivot table is in Excel 2010. Please let me know if this is causing the error.

The above statement for filtering the data worked finr when both the data and pivot table were on the same worksheet (excel 2010)
 
Upvote 0
The above statement for filtering the data worked finr when both the data and pivot table were on the same worksheet (excel 2010)

I think you've answered your own question, have you not? ;)

I don't use Sharepoint so don't know if that's an issue.
 
Upvote 0

Forum statistics

Threads
1,215,214
Messages
6,123,664
Members
449,114
Latest member
aides

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