DATE/TIME Stamp for "COMMENTS"

cmyeyez

Board Regular
Joined
May 10, 2013
Messages
62
does excel have an auto- date/time stamp that can be placed into the comments?
(similar to how the UserName auto populates in the comment based on who the excel software is registered under)
I would need this to track the date/time a comment was added to a cell.

Many thanks!
 
Tom Urtis Hey Tom, I tried to use your code in post#10 but I just deleted this line "If .Address <> "$A$1" Then Exit Sub" so it can work in the whole sheet, my question is, how can I add the user name who made the changes too ? i need to get the updates with username and timestamps ?
Thanks in advance
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Good Discussion guys...

However being a newbie, i think i am doing something wrong in adding this code.

Could someone guide by steps how to do this, please.

Thank you.
 
Upvote 0
Hi Tom,
I have a couple of questions regarding the VB code you posted.

1 - Can the code be modified to capture the changed text if the text is being copied from another cell rather than typed in?
2 - Can the date be displayed in another cell as well as a comment attached to the changed cell?
3 - If the date can be displayed in another cell, can that date be overwritten each time the triggering cell is modified.

Thanks for your help.
 
Upvote 0
Hi Tom,
Thank you, this works great! What if I wanted to add these comments only to a certain range of a certain worksheet, for example Sheet1!K3:K300 or the entire column K?

BTW, in order to add the username in front of the date and time in the comment, I changed the 4th to last line in your code to:

Format(Application.UserName & " " & VBA.Now, "MM/DD/YYYY at h:MM AM/PM") & ": " & Chr(10) & strNewText

Thanks!
 
Upvote 0
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Address <> "$A$1" Then Exit Sub
If IsEmpty(Target) Then Exit Sub
Dim strNewText$, strCommentOld$, strCommentNew$
strNewText = .Text
If Not .Comment Is Nothing Then
strCommentOld = .Comment.Text & Chr(10) & Chr(10)
Else
strCommentOld = ""
End If
On Error Resume Next
.Comment.Delete
Err.Clear
.AddComment
.Comment.Visible = False
.Comment.Text Text:=strCommentOld & _
Format(VBA.Now, "MM/DD/YYYY at h:MM AM/PM") & Chr(10) & strNewText
.Comment.Shape.TextFrame.AutoSize = True
End With
End Sub

I am interested in doing the same thing with this by adding date and time to every comment added to a couple sheets in the workbook.

I have existing code in both sheets so how would I add this code to existing code? I've tried it a few times and I cannot get it to work.

Any help would be greatly appreciated.
 
Upvote 0
Just to update all - to enable auto comment with user name and time stamp for the entire sheet - use the below code. I don't know how to make it specific for a range of cells or column, so please feel free to comment if you do:

Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If IsEmpty(Target) Then Exit Sub
Dim strNewText$, strCommentOld$, strCommentNew$
strNewText = .Text
If Not .Comment Is Nothing Then
strCommentOld = .Comment.Text & Chr(10) & Chr(10)
Else
strCommentOld = ""
End If
On Error Resume Next
.Comment.Delete
Err.Clear
.AddComment
.Comment.Visible = False
.Comment.Text Text:=strCommentOld & _
Format(Application.UserName & " " & VBA.Now, "MM/DD/YYYY at h:MM AM/PM") & ": " & Chr(10) & strNewText
.Comment.Shape.TextFrame.AutoSize = True
End With
End Sub
 
Upvote 0
I have tried unsuccessfully to follow several procedures in this thread. I am following Toms procedure shown below but can't get it to work on Office 2016.
1592992754352.png


I am following the steps below.
1592992899050.png


1592992981185.png


After the above step I press Alt + Q and then insert a comment but only get my name, no time and date stamp.
Can anyone point out what I'm doing wrong?

1592993033322.png
 
Upvote 0

Forum statistics

Threads
1,223,793
Messages
6,174,635
Members
452,575
Latest member
Fstick546

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top