Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a comment note in excel using vba 1

Status
Not open for further replies.
Apr 20, 2000
41
US
I'm using VBA within excel97 and trying to create a comment box with text that is wcreated using vba code. I'd like to write data into 1/more cells then automatically create a comment for that cell so users can see the data and a few other details if needed.

Is this possible in vba?

thanks
 
From excel97 VBA help:
Represents a cell comment. The Comment object is a member of the Comments collection.

Using the Comment Object

Use the Comment property to return a Comment object. The following example changes the text in the comment in cell E5.

Worksheets(1).Range("E5").Comment.Text "reviewed on " & Date

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

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

HTH Rgds
~Geoff~
 
Hi XLBO, is there a function to read data from a comment box that is attached to a excel97 cell ? Like to add a comment then read it & save to a variable.

many thanks

----------------------------------------

Using the Comment Object

Use the Comment property to return a Comment object. The following example changes the text in the comment in cell E5.

Worksheets(1).Range("E5").Comment.Text "reviewed on " & Date

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

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
 
Try something like this:
Sub GetCommentText()
For Each c In ActiveSheet.Comments
ComText = c.Text
Next

HTH Rgds
~Geoff~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top