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

Cannot Double-Click to Open a Workbook

When you double-click on a workbook in Windows, the Excel program should be started and the workbook loaded. When this ...

Discover More

Automatically Capitalizing Day Names

Type the name of any of the seven days into your document, and Word automatically makes sure it is capitalized. This is ...

Discover More

Replacing Hidden Text

Word allows you to format text so it can be easily hidden from view and from printing. If you want to convert the hidden ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Searching Comments

Need to find that misplaced comment in your worksheet? It's easy to do using the Find and Replace capabilities of Excel.

Discover More

Static Sizes for Comment Boxes

Adding comments to your worksheet can be helpful in documenting what the worksheet contains. If you want to make sure ...

Discover More

Managing Comments

If you frequently add comments to cells in a worksheet, Excel provides a variety of tools you can use to manage those ...

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 two more than 7?

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.