Skip to content

Instantly share code, notes, and snippets.

@robertsky
Created December 11, 2018 06:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertsky/3e630db6361746797a58fff489f24ea5 to your computer and use it in GitHub Desktop.
Save robertsky/3e630db6361746797a58fff489f24ea5 to your computer and use it in GitHub Desktop.
Timestamp UDF Excel
Function Timestamp(Reference As Range)
If IsNumeric(Application.Caller.Text) = False Or Application.Caller.Text = "0" Then
If InStr(Reference.Value2, "generated correctly") > 0 Then
'Debug.Print (Application.Caller.Address & " test2")
Timestamp = CStr(DateDiff("s", "01/01/1970 00:00:00", Now()) * 1000 + Int(1000 * Rnd))
Else
'Debug.Print (Application.Caller.Address & " test1")
Timestamp = ""
End If
Else
Timestamp = Application.Caller.Text
'Debug.Print (Application.Caller.Address & " 212 " & Application.Caller.Text)
End If
'Debug.Print (Application.Caller.Address & " 121 " & Application.Caller.Text)
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment