ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Comments with text from cells (https://www.excelbanter.com/excel-programming/278796-comments-text-cells.html)

coco

Comments with text from cells
 
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:



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


Henrik Wendel

Comments with text from cells
 

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

Or

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






"coco" skrev i meddelandet
...
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:



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/




J.E. McGimpsey

Comments with text from cells
 
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.

In article ,
coco wrote:

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:


coco

Comments with text from cells
 
Fantastic!

Both work solutions work perfectly.


Thanks for your help guys.



coco :D



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


David McRitchie[_2_]

Comments with text from cells
 
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....htm#mycomment

Macro to populate comments in a range with text values of another range (#addcomments)
http://www.mvps.org/dmcritchie/excel...tm#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

"coco" wrote in message ...
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:



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/





All times are GMT +1. The time now is 02:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com