
Following code show how to add and delete a comment on Cell A1
' Add a comment.
Sub addAComment()
Dim rng As Range
Set rng = ActiveSheet.Cells(1, 1)
If rng.Comment Is Nothing Then
rng.addComment
End If
rng.Comment.Text "Last Reviewed on " & Now()
End Sub
' Delete a comment.
Sub deleteComment()
Dim rng As Range
Set rng = ActiveSheet.Cells(1, 1)
If Not (rng.Comment Is Nothing) Then
rng.Comment.Delete
End If
End Sub
No comments:
Post a Comment