Selecting todays date

  • Thread starter Thread starter J.W. Aldridge
  • Start date Start 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
 
This should give you the current date in your systems default format.

ActiveSheet.PivotTables("PivotTable1").PivotFields("DATE"). _
CurrentPage = Date
 
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
 
ActiveSheet.PivotTables("PivotTable1").PivotFields("DATE").CurrentPage _
= format(Date,"dd-mmm")

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

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

Back
Top