CarlAbdelnour
New Member
- Joined
- Jul 19, 2018
- Messages
- 6
Hello, I'd like to set Pivotitems in Date Pivotfield to visible but I have error 13 type incompatibility. I set the Date field format to DateFormat and I could get the pivotitem name. Here is the code:
Sub filterdates()
Dim pitem As PivotItem
Sheets("PivotTableSheet").PivotTable("PivotTable").PivotFields("Date").CurrentPage = "(All)"
Sheets("PivotTableSheet").PivotTable("PivotTable").PivotFields("Date"). _
EnableMultiplePageItems = True
For Each pitem in Sheets("PivotTableSheet").PivotTables("PivotTable").PivotFields("Date").PivotItems
pitem.visible=true
next pitem
End Sub
A similar sub in the code is working in a userform and properties are the same.
Sub filterdates()
Dim pitem As PivotItem
Sheets("PivotTableSheet").PivotTable("PivotTable").PivotFields("Date").CurrentPage = "(All)"
Sheets("PivotTableSheet").PivotTable("PivotTable").PivotFields("Date"). _
EnableMultiplePageItems = True
For Each pitem in Sheets("PivotTableSheet").PivotTables("PivotTable").PivotFields("Date").PivotItems
pitem.visible=true
next pitem
End Sub
A similar sub in the code is working in a userform and properties are the same.