Filter PivotTable from cell value

faab456

New Member
Joined
Nov 23, 2017
Messages
1
I created a combobox with a list of customers. From the value selected, which is transfered to another cell automatically, I want to filter my PivotTable.

I recorded a macro to help me start but i'm completely lost.

Can anyone help?

Here is the macro I created
Sub Macro2()
'
' Macro2 Macro
'


'
With ActiveSheet.PivotTables("teste").PivotFields("Customer")
.PivotItems("ALFKI").Visible = False
.PivotItems("ANTON").Visible = False
.PivotItems("AROUT").Visible = False
.PivotItems("BERGS").Visible = False
.PivotItems("BLAUS").Visible = False
.PivotItems("BLONP").Visible = False
.PivotItems("BOLID").Visible = False
.PivotItems("BONAP").Visible = False
.PivotItems("BOTTM").Visible = False
.PivotItems("BSBEV").Visible = False
.PivotItems("CACTU").Visible = False
.PivotItems("CHOPS").Visible = False
.PivotItems("COMMI").Visible = False
.PivotItems("CONSH").Visible = False
.PivotItems("DRACD").Visible = False
.PivotItems("DUMON").Visible = False
.PivotItems("EASTC").Visible = False
.PivotItems("ERNSH").Visible = False
.PivotItems("FAMIA").Visible = False
.PivotItems("FOLIG").Visible = False
.PivotItems("FOLKO").Visible = False
.PivotItems("FRANK").Visible = False
.PivotItems("FRANR").Visible = False
.PivotItems("FRANS").Visible = False
.PivotItems("FURIB").Visible = False
.PivotItems("GALED").Visible = False
.PivotItems("GODOS").Visible = False
.PivotItems("GOURL").Visible = False
.PivotItems("GREAL").Visible = False
.PivotItems("GROSR").Visible = False
.PivotItems("HANAR").Visible = False
.PivotItems("HILAA").Visible = False
.PivotItems("HUNGC").Visible = False
.PivotItems("HUNGO").Visible = False
.PivotItems("ISLAT").Visible = False
.PivotItems("KOENE").Visible = False
.PivotItems("LAMAI").Visible = False
.PivotItems("LAUGB").Visible = False
.PivotItems("LAZYK").Visible = False
.PivotItems("LEHMS").Visible = False
.PivotItems("LETSS").Visible = False
.PivotItems("LILAS").Visible = False
.PivotItems("LINOD").Visible = False
.PivotItems("LONEP").Visible = False
.PivotItems("MAGAA").Visible = False
.PivotItems("MAISD").Visible = False
.PivotItems("MEREP").Visible = False
End With
With ActiveSheet.PivotTables("teste").PivotFields("Customer")
.PivotItems("MORGK").Visible = False
.PivotItems("NORTS").Visible = False
.PivotItems("OCEAN").Visible = False
.PivotItems("OLDWO").Visible = False
.PivotItems("OTTIK").Visible = False
.PivotItems("PERIC").Visible = False
.PivotItems("PICCO").Visible = False
.PivotItems("PRINI").Visible = False
.PivotItems("QUEDE").Visible = False
.PivotItems("QUEEN").Visible = False
.PivotItems("QUICK").Visible = False
.PivotItems("RANCH").Visible = False
.PivotItems("RATTC").Visible = False
.PivotItems("REGGC").Visible = False
.PivotItems("RICAR").Visible = False
.PivotItems("RICSU").Visible = False
.PivotItems("SANTG").Visible = False
.PivotItems("SAVEA").Visible = False
.PivotItems("SEVES").Visible = False
.PivotItems("SIMOB").Visible = False
.PivotItems("SPECD").Visible = False
.PivotItems("SPLIR").Visible = False
.PivotItems("SUPRD").Visible = False
.PivotItems("THEBI").Visible = False
.PivotItems("THECR").Visible = False
.PivotItems("TOMSP").Visible = False
.PivotItems("TORTU").Visible = False
.PivotItems("TRADH").Visible = False
.PivotItems("TRAIH").Visible = False
.PivotItems("VAFFE").Visible = False
.PivotItems("VICTE").Visible = False
.PivotItems("VINET").Visible = False
.PivotItems("WANDK").Visible = False
.PivotItems("WARTH").Visible = False
.PivotItems("WELLI").Visible = False
.PivotItems("WHITC").Visible = False
.PivotItems("WILMK").Visible = False
.PivotItems("WOLZA").Visible = False
End With
End Sub
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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