Filter Pivot Table with VBA

Euler271

New Member
Joined
Dec 4, 2017
Messages
31
I'm trying to filter a pivot table when the user selects an item from an ActiveX combo box. (I need to use the ActiveX combo box because after the user selects an item I want a combo box in another worksheet to populate based on the user's selection. I haven't found a way to do that using Excel's pivot table filters.)

I keep getting error 1004 ("Unable to set the CurrentPage property of the PivotField class").

My code is:

Dim pf as PivotField
Set pf = ActiveSheet.PivotTables("Provider Lookup PT").PivotFields("TIN")
pf.ClearAllFilters
pf.CurrentPage = cboTIN.Value

Any help would be very much appreciated.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
It seems my problem was that I didn't have the field "TIN" in the Report Filter box. I was hoping I didn't need to display that filter.
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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