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

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,225,472
Messages
6,185,178
Members
453,281
Latest member
shantor

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