• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Time Stamp

Hi Ninjas,

Used 2 vba codes from Hui ( which works perfectly :D ), that inserts username, date & time stamps .. but I encounter errors when I combined them to run on one sheet. I tried to use TODAY so that it would just show the Date without the time, but instead appears as blank. Need a little help.

Thanks in advance! :DD

Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range
Dim changeRng As Range
Dim uName As String
Dim curTime As Date
Dim newMsg As String

If Target.Column = 2 Then
Cells(Target.Row, "C").Value = Today
Cells(Target.Row, "D").Value = Now
End If

Set changeRng = Intersect(Target, Range("B:B"))
If changeRng Is Nothing Then Exit Sub
Application.EnableEvents = False
On Error GoTo SafetyNet
uName = Application.UserName
curTime = Now
newMsg = uName
For Each c In changeRng.Cells
Cells(c.Row, "L").Value = newMsg
Next c
Application.EnableEvents = True
End Sub


Excel Ninja
Staff member
Today is a Worksheet Function but not a VBA Function

I would change the code as follows

Application.EnableEvents = False
If Target.Column = 2 Then
Cells(Target.Row, "C").Value = Int(Now)
Cells(Target.Row, "D").Value = Now
End If
Application.EnableEvents = True
Disabling the events stops VBA going back when the date changes and checking the worksheet again.