Share via

Date Modified Function

Anonymous
2012-02-22T22:11:21+00:00

I set up a User Defined Function for Last Date MOdified in Excel 2007 via Visual Basic:

Public Function ModDate()

ModDate = Format(FileDateTime(ThisWorkbook.FullName), "m/d/yy h:n ampm")

End Function

When I input the function ModDate() into the spreadsheet, the date doesn't update automatically. I have to reinput the function or refresh the spreadsheet to make the function work.  Is there a better (yet easy) way to set up the last date modified in a spreadsheet so that I don't have to refresh the sheet each time?

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

HansV 462.6K Reputation points
2012-02-22T22:56:21+00:00

You could change the function to

Public Function ModDate()

    Application.Volatile

    ModDate = Format(FileDateTime(ThisWorkbook.FullName), "m/d/yy h:n ampm")

End Function

Whenever the worksheet is recalculated, the function will be updated.

Was this answer helpful?

6 people found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful