I'm changing a pivot table filter through a cell D2 in sheet Sales. To be specific, it's the date I type into cell d2 and it changes the date in the pivot table (in sheet PIVOT) showing then the data for the right month.
This works perfectly with the format mm/yy, but I'd like to be able to change the date if I type it in format mm.yy (the way it is now, it just overwrites a month in the filter of the pivot table in the wrong format).
I wanted to change this by the If condition bellow, but it doesn't work. How should I change the condition to make it work?
Month = Worksheets("Sales").Range("D2").Value
Sheets("PIVOT").PivotTables("PivotTable3") _
.PivotFields("Month").CurrentPage = Month
If Range("D2").NumberFormat = "mm.yy" Then
Range("D2").NumberFormat = "mm/yy"
End If
Aucun commentaire:
Enregistrer un commentaire