VBA Time Stamp Comment Box

tweetyramos

New Member
Joined
Jul 18, 2018
Messages
2
Sorry if this is redundant, I am looking for a VBA Code that will add a comment of date and time and keep the string of updates in the comment field so I can see how many changes that particular cell went through. I need to this to be able to work for each cell independently as each one will have a different customer name. The status of the cell will change for example might go from customer ABC arrive, to customer is now in service etc. (i want to be able to see how long in between updates it goes from arrived to completed, which is why i need all the time stamps to show). I had one previously that worked flawlessly but over wrote that sheet and have spent a number of hours trying to find it again with no luck.

Any help is greatly appreciated!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
At last I found it, thought I would share in case anyone needs it.

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(VBA.Now, "MM/DD/YYYY at h:MM AM/PM") & Chr(10) & strNewText
.Comment.Shape.TextFrame.AutoSize = True
End With
End Sub
 
Upvote 0
Here is a similar one I wrote but this only applies to column A
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Modified  7/18/2018  5:30:39 PM  EDT
If Not Intersect(Target, Range("A:A")) Is Nothing Then
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
Dim cmt As Comment
Set cmt = Target.Comment
    
    If cmt Is Nothing Then
        Target.AddComment Str(Now()) & vbNewLine & Target.Value
       With Target.Comment
        .Shape.TextFrame.Characters.Font.Size = 8
        .Shape.TextFrame.AutoSize = True
        .Shape.Fill.ForeColor.SchemeColor = 7
        .Visible = False
        End With
        Else
       With Target.Comment
        .Text Text:=Target.Comment.Text & vbNewLine & Str(Now()) & vbNewLine & Target.Value
        .Visible = False
   End With
    End If
   
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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