Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
BrotherSun
 
Posts: n/a
Default How do I reference the comments of a cell?

Can I reference the comments of a cell in a formula?

For example, in cell B1, I want to type something like =A1.Comment
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ardus Petus
 
Posts: n/a
Default How do I reference the comments of a cell?

dim sText as string
sText=Range("A1").Comment.Text

HTH
--
AP

"BrotherSun" a écrit dans le message
de news: ...
Can I reference the comments of a cell in a formula?

For example, in cell B1, I want to type something like =A1.Comment



  #3   Report Post  
Posted to microsoft.public.excel.misc
Ken Johnson
 
Posts: n/a
Default How do I reference the comments of a cell?

Hi BrotherSun,

Paste this User Defined Function into a standard module in the VBA
Editor of your workbook...

Public Function CELCOM(rgCELL As Range) As String
On Error GoTo NO_COMMENT
CELCOM = "Comment in " & _
rgCELL.Address(False, False) & _
":= " & _
rgCELL.Comment.Text
NO_COMMENT:
End Function

Example, say A1 has the comment "Have a nice day" and in Z1 you
want to view A1's comment, then, in Z1 type..

=CELCOM(A1)

After pressing Enter Z1 will contain...

Comment in A1:= Have a nice day

You can insert the function either by typing it in or by going
InsertFunction then on the Paste Function dialog select the All
category then the CELCOM function.

The function is not volatile, ie if the function is already in place in
a cell and the cell comment it refers to is changed, it will not
automatically update. So, to ensure that the CELCOM function returns
current comment, Press F9 to force the workbook to calculate.

Also, if the comment it refers to is multi-lined and you want the
CELCOM function result to multi-lined then you will have to format the
cell with the CELCOM function to have Text Wrapping.

If you are unsure as to how to get the function code in place, then...

1. Copy the code
2. Press Alt + F11 to get to the VBA Editor
3. Go InsertModule then paste the code into that module.
4. Press Alt + F11 to return to the worksheet.

Ken Johnson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgent date/scheduling calc needed jct Excel Worksheet Functions 3 February 24th 06 01:36 AM
how to include a cell reference that is contained in a cell withi. dutchinny Excel Worksheet Functions 5 October 24th 05 01:07 AM
Problem with formulas changing cell reference janicesweet Excel Discussion (Misc queries) 1 August 2nd 05 06:23 PM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
Flexible Cell Reference Brandt Excel Discussion (Misc queries) 5 June 2nd 05 10:23 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"