ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Don't want date to update (https://www.excelbanter.com/excel-programming/346548-dont-want-date-update.html)

Sandy

Don't want date to update
 
In cell A10 I have the formula =Today() which is fine, but how can I code
it so that when the file is saved the value in A10 at the next opening
doesn't update. (I know to use the "BeforeClose" sub procedure). In other
words it retains the date that the file was saved.
Sandy



Gord Dibben

Don't want date to update
 
Sandy

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
ActiveSheet.Range("A10").Value = Format(Date, "dddd, mmmm dd, yyyy")
End Sub


Gord Dibben Excel MVP

On Thu, 24 Nov 2005 22:50:54 -0000, "Sandy"
wrote:

In cell A10 I have the formula =Today() which is fine, but how can I code
it so that when the file is saved the value in A10 at the next opening
doesn't update. (I know to use the "BeforeClose" sub procedure). In other
words it retains the date that the file was saved.
Sandy



filo666

Don't want date to update
 
in the auto_close procedure make a code that save the value of A10 and paste
it on A9 (range("a9").value=range("a10").value) then, in a auto_open
procedure write:
if Range("A9")<"" then
Range("a9").select
selection.cut
'and then paste it in A10
else
Range("a10").formula="=today()"
end if
HTH
"Sandy" wrote:

In cell A10 I have the formula =Today() which is fine, but how can I code
it so that when the file is saved the value in A10 at the next opening
doesn't update. (I know to use the "BeforeClose" sub procedure). In other
words it retains the date that the file was saved.
Sandy




Sandy

Don't want date to update
 
Excellent Gord thank you.
Sandy

"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Sandy

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
ActiveSheet.Range("A10").Value = Format(Date, "dddd, mmmm dd, yyyy")
End Sub


Gord Dibben Excel MVP

On Thu, 24 Nov 2005 22:50:54 -0000, "Sandy"

wrote:

In cell A10 I have the formula =Today() which is fine, but how can I
code
it so that when the file is saved the value in A10 at the next opening
doesn't update. (I know to use the "BeforeClose" sub procedure). In other
words it retains the date that the file was saved.
Sandy






All times are GMT +1. The time now is 06:10 PM.

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