ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date Formula (https://www.excelbanter.com/excel-programming/431258-date-formula.html)

Steve

Date Formula
 
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!

RonaldoOneNil

Date Formula
 
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

"Steve" wrote:

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!


Patrick Molloy

Date Formula
 
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

"Steve" wrote in message
...
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!



Rick Rothstein

Date Formula
 
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.

--
Rick (MVP - Excel)



All times are GMT +1. The time now is 01:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com