View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default How can I link the text in a cell into a comment box?

You can use a User Defined Function.

You could have a UDF in A1 copy a comment from one cell to another.

Option Explicit
Function EchoComment(FCell As Range, TCell As Range)

If TCell.Comment Is Nothing Then
'do nothing
Else
TCell.Comment.Delete
End If

TCell.AddComment Text:=FCell.Text

EchoComment = ""

End Function


Then I could put this in any cell:
=echocomment(sheet2!b1,sheet1!a1)



If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

=======

Short course:
Hit alt-f11 to get to the VBE (where macros/UDF's live)
hit ctrl-R to view the project explorer
Find your workbook.
should look like: VBAProject (yourfilename.xls)

right click on the project name
Insert, then Module
You should see the code window pop up on the right hand side

Paste the code in there.

Now go back to excel to test it out.


Bijoy V J wrote:

Hi I want to add a comment to a cell. But the content of the comment box is
actually some text from another worksheet. Can I use a formula/link to
display the text instead of copying the text from the source worksheet to the
coment box manually? For example, I want to add a comment to cell A1 in
Sheet1. The content of the comment box should be the text in cell B1 in
Sheet2. The usual formula (=Sheet2!B1) doesnt work here. Thanks for the
replies in advance


--

Dave Peterson