Pasting Into a Comment

Written by Allen Wyatt (last updated June 6, 2022)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


10

Malcolm needs to copy a range of cells and paste them into a comment. (He doesn't need to paste the formulas in the range, just the results of the formulas.) When he tries to do this, every time he makes the comment editable, Excel undoes his selection and he cannot paste.

Historically this can be a bit of a tricky operation because of the way that Excel handles copying and pasting. One way that people have often handled it is to copy the cells from Excel and then paste them into another program, such as Notepad. You can then copy them back out of the other program and paste them into your comment. If you didn't want to use another program as an intermediary, then the only solution was to use a macro to grab what is in the range and stuff it into a comment.

A better solution, however, is to use the Office Clipboard, which is sort of like an expanded version of the Windows Clipboard. To use the Office Clipboard effectively, all you need to do is display it. Just display the Home tab of the ribbon and click the small icon at the bottom-right of the Clipboard group. The Office Clipboard is displayed at the left side of your worksheet.

Now, go ahead and select the cells you want to copy into the comment. When you press Ctrl+C to copy them, you see that they appear in the Office Clipboard pane. (See Figure 1.)

Figure 1. The Office Clipboard pane.

To paste the range into a comment, simply insert the comment where you want (or choose to edit an existing comment) and then click the range in the Office Clipboard pane. It is placed exactly where you want it—in the comment.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12446) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Use Filenames That Sort Properly

When storing your Excel workbook, you need to specify a file name to be used for the workbook. Take a moment to consider ...

Discover More

Removing All Formatting

Getting rid of formatting from a cell or group of cells can be done using several different techniques. This tip ...

Discover More

Shortcut to Merge Cells

Need to merge a bunch of cells together on a regular basis? You'll love the two macros in this tip which can make short ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (ribbon)

Anchoring Comment Boxes in Desired Locations

Want your comment boxes to appear someplace other than the right side of a cell? You may be out of luck, and here's why.

Discover More

Printing Formatted Comments

When you print your worksheet, you may want Excel to include your comments or notes as they appear on the screen. Here's ...

Discover More

Counting Comments in a Worksheet

Need to know how many comments are in a worksheet? You can figure out the count manually, or you can apply the handy ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is five more than 3?

2019-07-30 05:27:15

Harold Druss

Thanks Willy. Nice!


2019-07-29 12:36:59

Willy Vanhaelen

@Harold
Excelent idea but the macro can be simplfied a bit:

Sub PasteToComment()
Dim strData As String
' copy some range values
Sheet1.Range("C1:C31").Copy
' get the clipboard data
Dim O As New DataObject
O.GetFromClipBoard
strData = O.GetText
With ActiveCell
If .Comment Is Nothing Then .AddComment
.Comment.Text Text:=strData
End With
End Sub

You can also remove the "copy marching ants" by adding
Application.CutCopyMode = False


2019-07-28 06:48:03

Tim

Harold

Sub PasteToComment()

Thank you! Thank you! Thank you!

Worked perfectly once I leaarned how to set a reference to Microsoft.Forms


2019-07-27 11:07:45

Harold Druss

Tim
Here is a macro that do what you want.
Make sure to set a reference to Microsoft.Forms

Sub PasteToComment()
Dim rngData As Range
Dim strData As String
Dim sActiveCell
' copy some range values
Set rngData = Sheet1.Range("C1:C31")
rngData.Copy
' get the clipboard data
' magic code for is for early binding to MSForms.DataObject
With CreateObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
.GetFromClipBoard
strData = .GetText
End With
sActiveCell = ActiveCell.Address
With ActiveCell
If Not .Comment Is Nothing Then
Range(sActiveCell).Comment.Text Text:=strData
Else
Range(sActiveCell).AddComment
Range(sActiveCell).Comment.Text Text:=strData
End If
End With
End Sub


2019-07-27 09:36:28

Peter Atherton

Tim, try this macro

Sub copy2Comment()
Dim cmt As Comment, rng As Range, _
rng2Copy As Range, c As Range
Dim txt As String, str As String, Addr As String

Set rng = Selection.Areas(1)
Set rng2Copy = Selection.Areas(2)
If Selection.Areas.Count <> 2 Then
MsgBox "Select two Areas!", vbCritical
Exit Sub
End If
Addr = rng.Address
'pgc01 - Mr Excel 5th Aug 2006
If Range(Addr).Comment Is Nothing Then
Range(Addr).AddComment
Else
txt = Range(Addr).Comment.Text
End If
For Each c In rng2Copy
str = str & c & Chr(10)
Next

Range(Addr).Comment.Shape.Select
Range(Addr).Comment.Text Text:=txt & str
Range(Addr).Comment.Shape.TextFrame.AutoSize = True
End Sub

You must select two ranges, the comment range and the range to copy in that order. The comment range can be part of the data set; and so will be selectred twice. Note, it does actally copy anythng ;- )


2019-07-26 06:11:31

Tim

So how would this be done with a macro. Paste a range (C1:C31) of textI in to the comments of the active cell.


2018-09-12 10:20:00

James Woolley

@rajendra: I don't think you can paste into an Excel comment "with format." If you pick Review > Edit Comment, then right-click within the comment, you will see only one Paste option (which is the same as Ctrl+V). I don't think you can even develop a macro to paste into an Excel comment "with format," but it's an interesting challenge.


2018-09-12 01:31:57

rajendra

I have table in MS outlook email body.
This has to be pasted in Excel in comment as it is with format
Request your help


2018-09-04 13:37:59

Ronmio

I hadn't really used the handy Office Clipboard. Pretty slick. And it was right there all the time.


2018-09-01 10:24:37

J. Woolley

You could use the CopyValues macro I posted 2018-08-05; see http://excelribbon.tips.net/T013558_Pasting_Numeric_Values_in_Other_Programs.html#comment-form-hd


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.