Click here to Skip to main content
15,867,985 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to select more than 1 item (string) in pivot table filtering by VBA code.

What I have tried:

i just can select one item in pivot table filtering by VBA code
Posted
Updated 6-Mar-19 11:09am
Comments
Richard MacCutchan 6-Mar-19 15:21pm    
What have you tried?

1 solution

I suggest that you start recording a macro, set up your pivot manually, stop recording. Then examine the recorded macro and convert it to VBA code
 
Share this answer
 
Comments
navid fayaz 9-Mar-19 14:28pm    
This is my code that i can filter only one specific item like "AAA".help me to filter 2 or more specific items, "AAA" and "BBB".

ActiveSheet.PivotTables("PivotTable2").PivotFields("test1").PivotFilters.Add _
Type:=xlCaptionEquals, Value1:="AAA"
CHill60 9-Mar-19 17:02pm    
Well, despite having my solution down voted, my advice remains the same... record a macro that does what you want. Examine that macro to understand how to change your code.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900