MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Manipulating the =Now function in Excel

Posted by John DeMoura on October 18, 2001 5:10 AM

Is there a way to prevent the date function =Now() from updating on a workbook created as a template. Want the date to update when the Template is first opened, but want the date on the 'saved as' version to remain static as the original creation date. A VBA solution would be usefull.

Posted by Richie Turner on October 18, 2001 5:22 AM

In VBA you can use something like cells(x,y)=Now in the Workbook_Open event.


Private Sub Workbook_Open()
End Sub

This will insert the date in the cell as a value eg. 18/10/2001 as opposed to inserting the formula.

Hope this helps


Posted by Juan Pablo on October 18, 2001 6:00 AM

To avoid overwriting previous time try this instead.

Private Sub Workbook_Open()
If Cells(1,1)="" then Cells(1,1)=Now
End Sub

Juan Pablo