Hi there
This relates to another post I have here but is slightly different.
I am looking to write a macro that makes the last 7 days in the pivot chart visible. I am assuming all days are visible before the macro is run. So then when the macro is run, only the last 7 days are visible in the pivot chart.
My initial thinking is to make all the dates invisible/hidden and then make the last 7 days visible. But I am not too sure if this is the best method?
The below macro is a simple recording of the “date” being filtered to only show last weeks days.
How do I write the below code so it could be written generically so I can put it in a loop to do every pivot chart in a workbook? I can work on the loop myself. I just need a hand with this part please.
Sub Macro2()
'
' Macro2 Macro
'
'
ActiveSheet.PivotTables("PivotTable2").PivotFields("date").PivotFilters.Add _
Type:=xlDateLastWeek
End Sub
Thanks
Bookmarks