Display comments as data

S

sonika

I have a spreadsheet that contains data as well as comments in the firs
column. what i want is to copy and paste these comments in the secon
column so that they are visible like data and not as comments
 
M

Max

One way, using the "Function MyComment"* below

*Taken from Dave McRitchie's page at:
http://www.mvps.org/dmcritchie/excel/ccomment.htm

Just a couple of steps to help ease you in ..

In Excel,

Press Alt+F11 to go to VBE
Click Insert > Module
Copy > Paste the "Function MyComment"* below in
the module page, i.e. the whitespace on the right pane
(copy/paste everything within the dotted lines below)
------------ begin vba -----------
Function MyComment(rng As Range)
Application.Volatile
Dim str As String
str = Trim(rng.Comment.Text)
'// If you want to remove Chr(10) character from string,
then
str = Application.Substitute(str, vbLf, " ")
MyComment = str
End Function
-------------- end vba ------
Press Alt+Q to exit vb editor & return to excel

Now, assuming you have cell comments
in col A, A1 down
to be extracted into say, col B

Put in B1: =IF(ISERROR(MyComment(A1)),"",MyComment(A1))
Copy B1 down

Col B will return the comments (if any) in col A
(cells w/o comments will return blanks "")

--
Rgds
Max
xl 97
--
Please respond, in newsgroup
xdemechanik <at>yahoo<dot>com
---
sonika said:
I have a spreadsheet that contains data as well as comments in the first
column. what i want is to copy and paste these comments in the second
column so that they are visible like data and not as comments .


--
sonika
---------------------------------------------------------- --------------
sonika's Profile: http://www.excelforum.com/member.php? action=getinfo&userid=14972
View this thread:
http://www.excelforum.com/showthread.php?threadid=265987
 
Top