ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   setting comment text from VB code (https://www.excelbanter.com/excel-programming/356966-setting-comment-text-vbulletin-code.html)

Brad Sumner

setting comment text from VB code
 
I am needing to have VB code place text into the comment box of a series of
cells. Currently the text to be placed is being retrieved from other areas
and being held in a array. At the conclusion of another routine it needs to
be placed on a comparison page for comparing a group of choices. I have
tried using "Activecell.Comment = Comments(X)" where Comments(X) is the
array with the info. However this results in a error "Object does not
support this property or method". Honestly I am at a loss on how to
acomplish what I am wanting.

I have looked in the help documentation but was not able to locate what I
need. I appreciate all help given.

Randy Harmelink

setting comment text from VB code
 
Activecell.Comment = Comments(X) <<

Incorrect syntax.

If the cell doesn't already have a comment, you need to add it first:

ActiveCell.AddComment

Then, to set the text of the comment:

ActiveCell.Comment.Text Text:=Comments(X)


Trevor Shuttleworth

setting comment text from VB code
 
To find the Help just type comment, cursor into the middle of the word and
press F1.

To add a comment:

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

To modify a comment:

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

Fot the Active Cell:

With ActiveCell.AddComment
.Visible = False
.Text "reviewed on " & Date
End With

Regards

Trevor


"Brad Sumner" wrote in message
...
I am needing to have VB code place text into the comment box of a series of
cells. Currently the text to be placed is being retrieved from other
areas
and being held in a array. At the conclusion of another routine it needs
to
be placed on a comparison page for comparing a group of choices. I have
tried using "Activecell.Comment = Comments(X)" where Comments(X) is the
array with the info. However this results in a error "Object does not
support this property or method". Honestly I am at a loss on how to
acomplish what I am wanting.

I have looked in the help documentation but was not able to locate what I
need. I appreciate all help given.




Gary''s Student

setting comment text from VB code
 
Range("E6").Select
Range("E6").AddComment
Range("E6").comment.Visible = False
Range("E6").comment.Text Text:="Happy Day"

is a syntax that works. In your case "Happy Day" would be replaced by an
element of your string array.
--
Gary's Student


"Brad Sumner" wrote:

I am needing to have VB code place text into the comment box of a series of
cells. Currently the text to be placed is being retrieved from other areas
and being held in a array. At the conclusion of another routine it needs to
be placed on a comparison page for comparing a group of choices. I have
tried using "Activecell.Comment = Comments(X)" where Comments(X) is the
array with the info. However this results in a error "Object does not
support this property or method". Honestly I am at a loss on how to
acomplish what I am wanting.

I have looked in the help documentation but was not able to locate what I
need. I appreciate all help given.



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

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