Comments with text from cells

C

coco

I am using the below code to create comments. Does anyone know if it can
be modified so that the comments contain text from a given cell?

ActiveCell.AddComment
ActiveCell.Comment.Text Text:=""
ActiveCell.Comment.Visible = True

With ActiveCell.Comment.Shape.OLEFormat.Object
.Font.Name = "Arial"
.Font.Size = 20
.Font.Bold = True
.Width = 400
.Height = 300

End With



End Sub


coco :confused:
 
H

Henrik Wendel

ActiveCell.Comment.Text Text:= Range("A1").Text

Or

ActiveCell.Comment.Text Text:= Cells(1,1).Text
 
J

J.E. McGimpsey

One way:

With ActiveCell.AddComment( _
Text:=Worksheets("Sheet1").Range("A1").Text)
With .Shape
With .TextFrame.Characters.Font
.Name = "Arial"
.Size = 20
.Bold = True
End With
.Width = 400
.Height = 300
End With
.Visible = True
End With

Adjust your sheet and range reference to suit.
 
D

David McRitchie

Cell Comments
http://www.mvps.org/dmcritchie/excel/ccomment.htm

Function to obtain cell comments from another cell (#mycomment)
http://www.mvps.org/dmcritchie/excel/ccomment.htm#mycomment

Macro to populate comments in a range with text values of another range (#addcomments)
http://www.mvps.org/dmcritchie/excel/ccomment.htm#addcomments

Sub CommentPopulateSelection()
Dim cell As Range
Selection.ClearComments
If Trim(ActiveCell.Text) <> "" Then
For Each cell In Selection
cell.AddComment ActiveCell.Text
Next cell
End If
End Sub

or from a specific cell
cell.AddComment range("B4").Text

HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top