Correction (I forgot that the cell might be empty, but still have a
comment and not be merged):
Sub CommentsToCells()
Dim cl As Range
Dim rng As Range
Dim cmt As Comment
On Error Resume Next
Set rng = ActiveSheet.Cells.SpecialCells(xlCellTypeComments)
On Error GoTo 0
For Each cl In rng
Set cmt = cl.Comment
If IsEmpty(cl) _
Then
cl.Value = " : " & cmt.Text
Else
cl.Value = cl.Value & " : " & cmt.Text
End If
Next cl
End Sub
Your code is crashing in the case where cl.Value is empty (merged or
not). You cannot concantenate an empty variable with a string to get
another string.
--
Regards,
Bill Renaud
|