Hi everybody I have found the following code to use in my pivot table filter and select the months. My problem is that I want to select all the month before the current, for example if we have October the 10th month I want to select from January to September. The code i have select all month before 12th December. Can anyone help me to change this code to fit my need?
Sub PivotTest()
With ActiveSheet.PivotTables("PivotTable3").PivotFields("ÌÞíáò")
For i = 1 To .PivotItems.Count
If i < 12 Then
.PivotItems(i).Visible = True
Else
.PivotItems(i).Visible = False
End If
Next i
End With
ActiveSheet.PivotTables("PivotTable3").PivotCache.Refresh
End Sub