Date last modified macro



Hi guys,

I am wondering if there is a function or maro i can write in excel that
can show the date my .xls fle was last modified?

So i need it to only change when any cells are changed with in the
workbook but if the workbook is opened and just viewed at, the date
will not change. I know that information is in the properties of the
file but i need it to get that info and put it in a cell.

Thanks for the help.


In your Microsoft Excel Objects >> ThisWorkbook, insert this

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Range("A1") = Date 'format your cell to reflect your desired
date/time display
End Sub

Granted this happens only when the wb is saved, if you want it for
anytime a cell is changed, you will have to experiment with other built
in events.

Particularly, you may need to "Dim x as string" to grab the current
value on open and have it reuse that value, in the event that, altho
the wb is saved, no changes were made.


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