ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   paste command not work in 'comment' (https://www.excelbanter.com/excel-discussion-misc-queries/29233-paste-command-not-work-comment.html)

CoolKerala

paste command not work in 'comment'
 
how do i paste copied values in a comment

Jason Morin

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

---
HTH
Jason
Atlanta, GA


"CoolKerala" wrote:

how do i paste copied values in a comment


Dave Peterson

What did you copy?

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

CoolKerala wrote:

how do i paste copied values in a comment


--

Dave Peterson


All times are GMT +1. The time now is 01:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com