Using this code in VBA for an .xlsm workbook for a =LastChange formula that gives the last date and time any modification to the workbook was made:
I added the code to ThisWorkbook View Code, then type =LastChange in a cell and get #NAME?.
I have to be missing a step here. Any help?
Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
ThisWorkbook.Names("LastChange").RefersTo = Now
End Sub
I added the code to ThisWorkbook View Code, then type =LastChange in a cell and get #NAME?.
I have to be missing a step here. Any help?