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

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
 
S

st

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top