antaeusguy
Board Regular
- Joined
- Mar 8, 2010
- Messages
- 81
I've written a code to change the text of all comments in a workbook to "Comment is deleted."
I got part of this code off the web and modified myself.
I am trying to understand this code: cm.Parent.AddComment
What is the parent of the object comment? Isn't it Comments? How come in this case, the parent seems to be range (as the AddComment is a member of range).
Anyone who could enlighten me on this subject would be much appreciated
I got part of this code off the web and modified myself.
I am trying to understand this code: cm.Parent.AddComment
What is the parent of the object comment? Isn't it Comments? How come in this case, the parent seems to be range (as the AddComment is a member of range).
Anyone who could enlighten me on this subject would be much appreciated
Code:
Sub DelComments()
Dim cm As Comment
Dim ws As Worksheet
For Each ws In Worksheets
ws.Activate
For Each cm In ActiveSheet.Comments
cm.Delete
cm.Parent.AddComment Text:="Comment is deleted."
Next cm
Next ws
End Sub