Using today formula for a template

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to use the =today() formula on a telplate, and have it work for
the first time it is used only. Is there a way. OK to make it clear, if I
have this in a template, I would like to open a telplate, have today's dat
appear. and when it is saved, I need that date in there perminantly. Thanks
in advance.
 
You'll need to do that when you open the template copy.

If the target cell is empty then put today's date in it:

Private Sub Workbook_Open()

With Worksheets("Sheet1").Range("A1")
If .Text = "" Then
.Value = Date
End If
End With

End Sub
 
So you are saying that I can not use the =today() formula for the date. If I
did it would keep changing, everytime it was opened.
 
That is correct. But it's not a big deal to add the code that runs when you
open a workbook.

Press Alt-F11.
Press Ctrl-R
Find your template in the list, and under the template double-click on This
Workbook
Paste in the code below, changing Sheet1 to the name of the sheet where you
want the date and changing A1 to the address of the cell where you want the
date.

Save the file
 

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