Hi all,

I have this code, where when an event is triggered the current time should appear where the function is. However, the time appears but only for a couple of seconds and then a list of zeros appear instead of the time. I have adapted this function from another sheet (where it used to play a WAV file), but I would need for it to keep its value rather than reversing to zeroes. Where is the catch?

Many thanks

BC



Dim seventIN As String
Function EventChanged(sUnit As String, sNew As String)

If sUnit = "IN" Then
If seventIN = "" Or IsNull(seventIN) Then
seventIN = sNew
EventChanged = "00:00:00"
ElseIf UCase(seventIN) <> UCase(sNew) Then
seventIN = sNew
EventChanged = Format(Time(), "hh:mm:ss")
End If

End If
End Function