Mega Code Archive

 
Categories / VisualBasic Script / Excel
 

Tracking cell changes in a comment

Private Sub Worksheet_Change(ByVal Target As Excel.Range)     For Each cell In Target         With cell             On Error Resume Next             OldText = .Comment.Text             If Err <> 0 Then .AddComment             MsgBox OldText & "Changed by " & Application.UserName & " at " & Now & vbLf             .Comment.Text NewText             .Comment.Visible = True             .Comment.Shape.Select              Selection.AutoSize = True             .Comment.Visible = False         End With     Next cell End Sub