filter for multiple things in pivot table with vba

spq24

Board Regular
Joined
Jan 18, 2010
Messages
52
I have created a pivot table that reads off of source data that refreshes every day. The pivot table is going to refresh to show the current data. However, I only want to show the data for two of the row tables "data 1" and "data 2". The problem is that sometimes when the data refreshes new data comes in that wasn't in there before and it will be pulled into the pivot table lets call this "data 3" and "Data 4".

I want the macro to refresh the table, and then filter to only show "Data 1" and "data 2" not anything else.

I can't just do .pivotitems("data 4").visible = false because it is unpredictable what "data 3", "data 4", etc. will be so I can't just eliminate it.

Can anyone help?
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,224,614
Messages
6,179,906
Members
452,949
Latest member
beartooth91

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