How do I change the date in a pivot table pagefield using VBA

  • Thread starter Thread starter st
  • Start date Start date
S

st

My pivot table shows one day's worth of data. I have multiple
departmenst in the rows, and 3 categories of expenditures in the
columns. I use the Page area to show a date. How do I use VBA to
change the date to today()-1 (yesterday).

Thanks
 
I defined the date I want to use w/ dim and then used this code:

Dim pvtdate as date

pvtdate = Worksheets("By Trade").Range("d75").Text

ActiveSheet.PivotTables("PivotTable1").PivotCache.refresh
ActiveSheet.PivotTables("PivotTable1").PivotFields("DT_TRANS_DATE"). _
CurrentPage = pvtdate
 
Back
Top