Share via

Update a date when opened

Anonymous
2014-12-01T21:26:44+00:00

Could someone please tell me how to have a cell in excel have the date change to the date it is opened

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2014-12-01T21:46:48+00:00

There are two ways - one will 'stick', one will change each time the file is opened.

First, the method that changes each time you open the file:  Put this formula into a cell and format it as you desire (date, date/time, etc):

=NOW()

If you need something more permanent, then you have to resort to VBA (a macro).  This code goes into the 'ThisWorkbook' code module, and you can find instructions for putting it there here:

http://www.contextures.com/xlvba01.html#Workbook

Private Sub Workbook_Open()

  'you need to provide the actual name of

  'the sheet to put the date into and the

  'address of the cell on that sheet to put it into

  'format that cell as you want it to look (date date/time etc.)

  '

  'only put the date into the cell when there is not already

  'a date in it

  If IsEmpty(ThisWorkbook.Worksheets("Sheet1").Range("A1")) Then

    'write the date to the cell.

    ThisWorkbook.Worksheets("Sheet1").Range("A1") = Now()

  End If

End Sub

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful