This documentation is archived and is not being maintained.

Comments Collection Object [Excel 2003 VBA Language Reference]

Office 2003
Worksheet
Comments
Comment
Shape

A collection of cell comments. Each comment is represented by a Comment object.

Using the Comments Collection

Use the Comments property to return the Comments collection. The following example hides all the comments on worksheet one.

Set cmt = Worksheets(1).Comments
For Each c In cmt
    c.Visible = False
Next
		

Use the AddComment method to add a comment to a range. The following example adds a comment to cell E5 on worksheet one.

With Worksheets(1).Range("e5").AddComment
    .Visible = False
    .Text "reviewed on " & Date
End With
		

Use Comments(index), where index is the comment number, to return a single comment from the Comments collection. The following example hides comment two on worksheet one.

Worksheets(1).Comments(2).Visible = False
		


Methods | Item Method

Parent Objects | Worksheet

Child Objects | Shape


Show: