+ Reply to Thread
Results 1 to 6 of 6

Track Cell History in Comment?

Hybrid View

  1. #1
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Track Cell History in Comment?

    Perhaps you can adapt this:
    Private Sub Worksheet_Change(ByVal Target As Range)
        Const sRng      As String = "A1:A10"    ' change as required
        Dim sOld        As String
        Dim sNew        As String
        Dim sCmt        As String
        Dim iLen        As Long
    
        With Target(1)
            If Intersect(.Cells, Range(sRng)) Is Nothing Then Exit Sub
            sNew = .Text
            Application.EnableEvents = False
            Application.Undo
            sOld = .Text
            .Value = sNew
            Application.EnableEvents = True
    
            sCmt = Format(Date, "yyyy-mmdd") & ": Was """ & sOld & """ is """ & sNew & """"
    
            If .Comment Is Nothing Then .AddComment
    
            With .Comment.Shape.TextFrame
                iLen = Len(.Characters.Text)
                .AutoSize = True
                .Characters(Start:=iLen + 1).Insert IIf(iLen, vbLf, "") & sCmt
            End With
        End With
    End Sub
    Last edited by shg; 07-29-2011 at 12:45 PM.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1