Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88854

Filter for the previous month only - Excel VBA

$
0
0

I have a data set for the past 11 months (from Apr 2019 to Feb 2020). I have created a pivot wherein I am trying to filter for all months except the current month. The Month is in the format - 1, 2, 3... and so on. The code I am using is as follows -

With ActiveSheet.PivotTables("Summary_2").PivotFields("Month")
        .Orientation = xlPageField
        .Position = 3
ActiveSheet.PivotTables("Summary_2").PivotFields("Month").CurrentPage = "(All)"
ActiveSheet.PivotTables("Summary_2").PivotFields("Month"). _
EnableMultiplePageItems = True
For Each pit In ActiveSheet.PivotTables("Summary_2").PivotFields("Month")
.PivotItems("" = "& v").Visible = False
Next
End With

I am unable to get any result from this. Can anyone help me?


Viewing all articles
Browse latest Browse all 88854


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>