Hi Buck,
A of modification to Ron's will solve that
1) Use .text instead of .value
Additional comments:
2) Actually you didn't ask but if you want to replace a comment
either delete all comments in the range
or comment if you have a replacement.
otherwise old comment remains unchanged
3) you can use ActiveSheet if one of them really
is the activesheet.
Sub test111()
Dim cell As Range
Application.ScreenUpdating = False
For Each cell In Sheets("Sheet1").Range("A1:A500")
On Error Resume Next
'Sheets("Sheet2").ClearComments '-- would be faster
If Sheets("sheettwo").Range(cell.Address).Text <> "" Then
cell.Comment.Delete '-- delete a possible preexisting comment
cell.AddComment Text:=Sheets("Sheet2") _
.Range(cell.Address).Text
End If
On Error GoTo 0
Next cell
Application.ScreenUpdating = True
End Sub
My page on cell comments is :
http://www.mvps.org/dmcritchie/excel/ccomment.htm
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages:
http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page:
http://www.mvps.org/dmcritchie/excel/search.htm
Buck Turgidson said:
Thanks. Worked great. Once small glitch was when the comment was a numeric
value with no text, it did not work. But I just edited the column and
placed a quote before the number before running the macro, which took care
of it.
Thanks again!