Date Formula

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I have a spreadsheet template which has a date cell set up with =Today()
Formula. Simple. The tricky part is I want it so that once I turn the
template into an actual spreadsheet that the next time I open this
spreadsheet to review the data it won't change the date to today's date.

Ways I came up with:

Maybe program the Today formula so that if data is entered into A16 (which
is where data would be entered if spreadsheet was no longer a template) then
don't do Today().

I know there is probably a better way to do this.

Please help! Thank you!
 
In your routine that changes it from a template to an actual, copy the data
and pastespecial. E.g. A1 contains =TODAY()

Range("A1").Copy
Range("A1").PasteSpecial xlPasteValues
 
in the workbook's Open event:-

Option Explicit

Private Sub Workbook_Open()
with worksheets("sheet1").range("A1")
.value = date
.numberformat="dd-mmm-yy"
end with
End Sub
 
In your routine that changes it from a template to an actual,
copy the data and pastespecial. E.g. A1 contains =TODAY()

Range("A1").Copy
Range("A1").PasteSpecial xlPasteValues

Actually there is a simpler way...

Range("A1").Value = Range("A1").Value

That will overwrite the formula in A1 with the current value being displayed
in A1.
 
Back
Top