Linking Comments

  • Thread starter Thread starter heidi
  • Start date Start date
H

heidi

Is there a way to link a cell value and comment to a cell
in another workbook so that it shows up exactly the same
as the original? I know how to link cells, but the
comments don't come across in the link.
 
Further to Frank you'd have to use a macro (a VB function) to return a
cell's comment, e.g.,

Function GetCellComment(Cell As Range) As String
On Error Resume Next ''In case no comment
GetCellComment = Cell.Comment.Text
End Function

Then in a cell:

=GetCellComment(A1)
 
Hi Jim
good point but that does just return the comment content in the target
cell but maybe this is sufficient for the OP :-)
 
I think that this is one of the very few exceptions to the rule.

In fact, you could have a UDF in A1 copy a comment from one cell to
another--even in different workbooks!

Option Explicit
Function EchoComment(FCell As Range, TCell As Range)
Application.Volatile

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

If FCell.Comment Is Nothing Then
'do nothing
Else
TCell.AddComment Text:=FCell.Comment.Text
End If
EchoComment = ""

End Function

Then I could put this in any cell:
=echocomment([book1.xls]sheet2!a3,[book2.xls]sheet1!a5)
 
Hi Dave
never thought this would be possible!
So comments are not Excel environment' :-)
Thanks for this UDF

--
Regards
Frank Kabel
Frankfurt, Germany

Dave said:
I think that this is one of the very few exceptions to the rule.

In fact, you could have a UDF in A1 copy a comment from one cell to
another--even in different workbooks!

Option Explicit
Function EchoComment(FCell As Range, TCell As Range)
Application.Volatile

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

If FCell.Comment Is Nothing Then
'do nothing
Else
TCell.AddComment Text:=FCell.Comment.Text
End If
EchoComment = ""

End Function

Then I could put this in any cell:
=echocomment([book1.xls]sheet2!a3,[book2.xls]sheet1!a5)




Frank said:
Hi Heidi
formulas can only eturn values. So you can't link comments
 
Back
Top