copy cells to a comment

J

Jakobshavn Isbrae

How do I copy the contents of a set of cells into a comment ?

Thank you very much in advance
 
J

Jakobshavn Isbrae

I have about 30 items in cells in a single column that I would like to copy
and paste in a single column in the comment.

I can select the cells in the worksheet and copy them, but in the comment my
CNTRLv gets ignored.

I can't determine what I am doing wrong.

Thank you for your help.
 
A

Ardus Petus

Select the 30 cells, then run this macro:

'--------------------------------------------
Sub InsertComment()
Dim rCell As Range
Dim sText As String

For Each rCell In Selection
sText = sText & rCell.Text & vbLf
Next rCell

On Error Resume Next
Set rCell = Range(InputBox("Cell to comment"))
On Error GoTo 0
If rCell Is Nothing Then
MsgBox "Invalid input"
Exit Sub
End If
rCell.ClearComments
rCell.AddComment sText
End Sub
'-------------------------------------------------

HTH
 
J

Jakobshavn Isbrae

Works perfectly !
I am amazed how fast you made this for me.
You have saved me hours of typing.
Thank you once more.
 
Top