Static date and time stamp VBA

857 Views Asked by At

I have the following code in a module for a date and time stamp but when I open the spreadsheet each day, the spreadsheet is restamping and putting the present date and time from today instead of yesterday. Does anyone know if I'm missing something in the code to stop the spreadsheet from doing this as I need to retain the stamps from when they happened? Thanks in advance.

    If Reference.Value <> "" Then
        Datestamp1 = Format(Now, "dd/mm/yyyy HH:mm")
    Else
        Datestamp1 = ""
    End If

    Application.EnableEvents = False

End Function
0

There are 0 best solutions below