How preserve the value of NOW() or TODAY()?

  • Thread starter Thread starter Nathan Gutman
  • Start date Start date
N

Nathan Gutman

I like to write code to preserve the value of NOW() or TODAY().
When user opens the workbook the first time current system date + 30
day should be recorded and it should not change with subsequent
openings of the workbook.
I can do that manually inserting TODAY() into A1 then copy/paste
special/values only to B1. Then make C1 = B1 + 30
How to do it in an efficinet macro.
I know that I can use Range("A1").Copy Range("B1") but this copies the
formula not just the value.
 
With Range("B1")
.Formula = Range("A1").Value + 30
.Numberformat = "mm/dd/yyyy"
End With
 
Thanks Tom, both seem to be working.
Where and how did you learn how to do thigns like that?
 
Thanks Tom, both seem to be working.
Where and how did you learn how to do things like that?
 
Hi Tom,
In the second example how does the code know that Date is the value of
Today() from A1?
 
It doesn't. Date is the VBA equipvalent of the worksheet function =today().
I was suggesting that there was no reason to store a date in A1 if the only
purpose was to use it as a reference for advancing 30 days.
 
Back
Top