paste command not work in 'comment'

  • Thread starter Thread starter Guest
  • Start date Start date
If you want to copy a range of values into a comment, here's a start. Select
the range of values first, then run the macro. It'll prompt you for a cell
location to which you'll create a comment containing the values.

Sub CopyIntoComment()
Dim cell As Range
Dim strAllCells As String
Dim strComLocation As String

If Intersect(ActiveSheet.UsedRange, Selection) Is Nothing Then
MsgBox "Nothing selected."
Exit Sub
End If

strComLocation = InputBox("Enter cell where comment will go:")
If strComLocation = "" Then Exit Sub

For Each cell In Selection
strAllCells = strAllCells & cell
Next

With Range(strComLocation)
If Not .Comment Is Nothing Then
MsgBox "Comment already in cell."
Exit Sub
End If
.AddComment
.Comment.Text Text:=strAllCells
End With

End Sub
 
What did you copy?

If you copied the cell, try copying the contents of the cell from the formula
bar.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top