Previous data in a comment
I use the codes below to track versions (put the previous data in a
comment). But it only works for direct entry (directly typing data into
a cell). Is it possible to do the same thing for formula-generated
entry?
Thanks in advance
Option Explicit
Public acVal
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim ThisChange
ThisChange = Now()
On Error Resume Next
Target.AddComment
Target.Comment.Text "Before you make this change on " &
ThisChange & ", the value was " & acVal
Target.Comment.Shape.TextFrame.Characters(67).Font .Color =
RGB(255, 0, 0)
Target.Comment.Shape.TextFrame.Characters(1).Font. Size = 10
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If ActiveCell.Address < Target.Address Then Exit Sub
If Target.Value = "" Then
acVal = ""
Else
acVal = Target.Value
End If
End Sub
|