Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was wondering if it was possible to add a date every time I open my excel sheet. I know the function is =TODAY(), how can I proceed to do this for example let's say :

1 02/05/2013 (Today's date, it would be automatically written unless it is today's date)
2 03/05/2013 (Tomorrow's date, if I open it tomorrow.) 
share|improve this question
up vote 1 down vote accepted

You can do this with a Macro . The Workbook_Activate is fired at the load event so this should work:

Private Sub Workbook_Activate()
    If Not IsEmpty(Range("A1").Value) Then
         Range("A1").Value = Date
    End If         
End Sub

If that doesn't work, change the sub to

Private Sub Workbook_Open()


I updated my code based upon your comment, but this may be a design fault. If you're always writing to A1 for example, it means by the next day there will be a value. I think you need to test the value, however, this is possibly over kill for such a simple command.

Private Sub Workbook_Activate()
    If Not Range("A1").Value = Date Then
         Range("A1").Value = Date
    End If         
End Sub

If it were me, I'd just overwrite the value every time you load and not bother with the check since it's not expensive.

share|improve this answer
Tank you very much, I'll google how to check if a cell is empty so I can set A1 to A2 if A1 != empty – Meds May 2 '13 at 14:34
Thank you so much. – Meds May 2 '13 at 14:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .