Please Note: This article is written for users of the following Microsoft Excel versions: 2007 and 2010. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Moving Comment Background Pictures to Cells.

Moving Comment Background Pictures to Cells

Written by Allen Wyatt (last updated April 22, 2021)
This tip applies to Excel 2007 and 2010


Francois has a bunch of comments in a worksheet, and each comment contains a picture as a background. He would like to remove those background pictures from the comments and place them, instead, as graphics in the cells just to the right of where the comments are located.

The only way to do this is with the aid of a macro. The reason is that you cannot manually select and copy any graphic that has been stored in the background of a comment. You can, in a macro, approximate "grabbing" the image:

Sub CommentPictures()
    Dim cmt As Comment
    Dim rCell As Range
    Dim bVisible As Boolean

    For Each cmt In ActiveSheet.Comments
        With cmt
            bVisible = .Visible
            .Visible = True
            Set rCell = .Parent.Offset(0, 1)
            .Shape.CopyPicture _
              Appearance:=xlScreen, Format:=xlPicture
            Selection.ShapeRange.LockAspectRatio = msoFalse
            Selection.Width = rCell.Width
            Selection.Height = rCell.Height
            .Visible = bVisible
            .Shape.Fill.OneColorGradient msoGradientFromCenter, 1, 1
        End With
    Next cmt
End Sub

The macro steps through each comment in the active worksheet. The entire comment (including the background) is copied as a graphic to the Clipboard, then it is pasted into the desired cell. The background of the comment is then set to a different fill instead of the graphic.

You should note that this approach provides only an approximation of grabbing the background picture. It also, in copying the entire comment as a graphic, copies any text that is contained in the comment.


If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11165) applies to Microsoft Excel 2007 and 2010. You can find a version of this tip for the older menu interface of Excel here: Moving Comment Background Pictures to Cells.

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. ...


Find and Replace in a Column or Row

Need to search for information in a table? Word allows you to easily limit your search to an entire column or row, as ...

Discover More

Changing Outline Structure

When working with the outline of a document, you can easily move whole sections of your document. It is as easy as ...

Discover More

Subtotals Option Grayed Out

The Subtotals option on the Data menu is normally available for adding or removing subtotals to data tables. If the ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development 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

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

Filtering for Comments (Notes)

Excel makes it easy to filter a data table based on various values in that table. It isn't so easy to filter according to ...

Discover More

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

View most recent newsletter.


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

2021-09-11 13:35:54

Kurt Müller

Attention: A "funny" thing with .LockAspectRatio = msoTrue is the following:

The standard shape of a comment is a rectangle. It shows four circles in each corners and four circels in each middle of the sides.

If .LockAspectRatio = msoTrue is used the AspectRatio is only locked, if the comment shape is drawn at the circles in the corners.

But the AspectRatio is easily destroyed, if the comment shape is drawn left or right, up or down at the circles in the middle of the sides.

So anybody else who is using the workbook together with others can destroy the AspectRatio of the background pictures easily. If the worksheets in the workbook have a large amount of comments with background pictures it is not affordable to rescue distorted AspectRatios for the pictures manually.

(see Figure 1 below)

Figure 1. comment shape

2021-07-18 05:25:23

Kurt Müller

To make sense to move comment background pictures to cells it is necessary to preserve the scale of the inserted user picture:

Sub insert_userpicture_in_comments()

Dim rngZelle As Range

Dim strFilename As Variant
Dim strFilter As String
Dim ScaleValue As Single
Dim ScaleValue2 As Single

Dim objPic As IPictureDisp
Dim Source As String

Dim i As Integer

If ActiveSheet.Comments.Count = 0 Then
MsgBox "No comments in entire sheet"
Exit Sub
End If

strFilter = "JPG Files (*.jpg), *.jpg" _
& ", GIF Files (*.gif), *.gif" _
& ", Bitmaps (*.bmp), *.bmp" _
& ", WMF Files (*.wmf), *.wmf"

strFilename = Application.GetOpenFilename(strFilter)

If strFilename = False Then GoTo LabelA

Source = (CStr(strFilename))

Set objPic = LoadPicture(Source)

With objPic
ScaleValue = .Width / .Height
End With

If MsgBox(ScaleValue, vbOKCancel) = vbCancel Then GoTo LabelA

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

For Each rngZelle In Selection.Cells
With rngZelle
If Not .Comment Is Nothing Then

With .Comment.Shape

.Shadow.Visible = msoFalse

.LockAspectRatio = msoFalse
.Width = 150
' .Width = ScaleValue * .Height
.Height = .Width / ScaleValue
.Fill.UserPicture strFilename
.LockAspectRatio = msoTrue

ScaleValue2 = .Width / .Height

End With
End If
End With
Next rngZelle


Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True

End Sub

2021-07-11 04:30:58

Kurt Müller

Back to the comment standard leads: .Shape.Fill.Solid

With cmt
bVisible = .Visible
.Visible = True
Set rCell = .Parent.Offset(0, 1)
.Shape.CopyPicture _
Appearance:=xlScreen, Format:=xlPicture
Selection.ShapeRange.LockAspectRatio = msoFalse
Selection.Width = rCell.Width
Selection.Height = rCell.Height
.Visible = bVisible


End With

2015-02-24 04:42:03


Perfect macro, it was helpful for me. Thanks a lot. I deleted the row SHAPE.FILL to keep picture also in the comment.

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

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.