vba add timestamp after macro execution in Excel
Q157. In Excel, how can I add a Timestamp after macro execution?
To do it in Excel, here is the answer:
- Option Explicit
- Sub AddTimeStamp()
- ActiveSheet.Range("A2") = "Last Updated On " & Format(Now, "dd-mmm-yyyy, hh:mm")
- End Sub
a) Line 3 gets the system time and updates cell A2 with the same in the specified format.
Result after Macro execution: