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 :smile:
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,223,954
Messages
6,175,601
Members
452,658
Latest member
GStorm

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