Thanks that works but i get a run time error '13' type missmatch then the second half does not work and has the same error, even if i comment out the first half
Sub Macro7()
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Created")
For i = 1 To .PivotItems.Count
If CDate(.PivotItems(i).Name) < Date - 7 Then
.PivotItems(i).Visible = False
End If
Next i
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Created")
For i = 1 To .PivotItems.Count
If CDate(.PivotItems(i).Name) > Date - 1 Then
.PivotItems(i).Visible = False
End If
Next i
End With
End Sub
Bookmarks