Controlling pivot table with an Combo box

oldmanwilly

Board Regular
Joined
Feb 24, 2016
Messages
221
Hi

I want to control a pivot table with a combo box value as some people don't like to use the pivot table type filter. I have tried this code:

Code:
Sub weekly_select_region()
'
' weekly_select_region Macro


    Sheets("compact summary").Select
    ActiveSheet.PivotTables("pivottable8").PivotFields("risk level").Currentpage = Range("c1").Text
    
End Sub

I have a combobox and the value is linked to cell a1, in C1 there is a vlookup that lookups the value of a1 brings back the same value in the combo box. I linked the above VBA to the control box and I thought when C1 would change it would filter the values that matched what was selected in the combo box but I get a message saying unable to get pivotfield property.

Any views on if this is the best way to go about filtering with a combo box or if my code just needs a syntax change?

Thanks
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,214,599
Messages
6,120,453
Members
448,967
Latest member
grijken

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