Formula for date

Sindesh - Aug 28, 2010 at 03:22 PM
 Ray - Aug 30, 2010 at 05:03 PM

I am doing a macro in which while doing page setup we have to put that days date in header, Is there any formula we could give so that it automatically takes the present date while running the macro into the header.


2 responses

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Aug 29, 2010 at 09:31 PM
not clear.
in excel vba DATE is used for entering today's date. But this is a volatile function and the entry may change tomorrow. so you want to fixed after entering date
copy and pastespecial on the same cell values only so that it will not change tomorrow.
' Choose where you want the date to go in the header.
With ActiveSheet.PageSetup
.LeftHeader = Date
.CenterHeader = Date
.RightHeader = Date
End With

This will populate the page header with the current date each time it is run.