Macro to filter off Pivot table except certain data

anzer

Board Regular
Joined
Mar 5, 2015
Messages
67
Hello,

So I have a pivot table with a pivotField called "Ship Month"
I need to update them with my command button to only take this month (now it is September and the field called unscheduled)
The issue is that I can't put

With ActiveSheet.PivotTables("PivotTable6").PivotFields("Ship Month")
.PivotItems("January").Visible = False
.PivotItems("February").Visible = False
.PivotItems("March").Visible = False
.PivotItems("April").Visible = False
.PivotItems("May").Visible = False
.PivotItems("June").Visible = False
.PivotItems("July").Visible = False
.PivotItems("August").Visible = False
.PivotItems("September").Visible = True
.PivotItems("October").Visible = False
.PivotItems("November").Visible = False
.PivotItems("December").Visible = False
.PivotItems("Unscheduled").Visible = True
End With
End Sub

For the simple reasons that when a month end, it will not be part of the pivot table the next day, so I will have a error because months January to August are not there

Is there a way I can unselect and and only mark as true the present month + the field called unscheduled

Thank you :)
 

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,216,227
Messages
6,129,609
Members
449,520
Latest member
TBFrieds

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