Selecting todays date

J

J.W. Aldridge

Any way to rewrite the code below to choose whatever the current date
is instead of a specific date? =today().


ActiveSheet.PivotTables("PivotTable1").PivotFields
("DATE").CurrentPage = _
"12/22/08"


I am trying to set up the sheet code to refresh the two pivot tables
on the page and then change the dates to whatever the current date
whenever the sheet is selected.

thanx
 
J

JLGWhiz

This should give you the current date in your systems default format.

ActiveSheet.PivotTables("PivotTable1").PivotFields("DATE"). _
CurrentPage = Date
 
J

J.W. Aldridge

Thanx!

That works...


One question though...

How to change the format on that...?

My current date format is ##-Mmm.
The default is mm/dd/yyyy.

Although the date populates in the pivot table field, it does not
actually work because of the difference in format.

Thanx again
 
D

Dave Peterson

ActiveSheet.PivotTables("PivotTable1").PivotFields("DATE").CurrentPage _
= format(Date,"dd-mmm")

Is ##-Mmm the day number (2 digits) and the abbreviated month name?
 
Top