Recording and saving dates in Excel

  • Thread starter Thread starter Bobito
  • Start date Start date
B

Bobito

I use the formula =if(<cell_ref>="X";=today();"") to determine when a report
was changed. However, every time I open the file, the formula always returns
todays date (naturally !!).
How do I record and save as a fixed entry the date the <cell_ref> was changed?
 
Bobito,

Copy the code below, right-click the sheet tab, select "View Code" and paste the code into the
window that appears. Change the A2:A1000 to the range address of the cells with the formula
described below, and anytime they first calculate to show a date and not "", they will automatically
convert to a date value.

HTH,
Bernie
MS Excel MVP

Private Sub Worksheet_Calculate()
Dim myC As Range
For Each myC In Range("A2:A1000")
If myC.HasFormula And myC.Value <> "" Then myC.Value = myC.Value
Next myC
End Sub
 

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