ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I change the date in a pivot table pagefield using VBA (https://www.excelbanter.com/excel-programming/414065-how-do-i-change-date-pivot-table-pagefield-using-vba.html)

st

How do I change the date in a pivot table pagefield using VBA
 
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

st

How do I change the date in a pivot table pagefield using VBA
 
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

st wrote:
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



All times are GMT +1. The time now is 08:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com