Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. 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: Editing a Comment Close to Its Cell.

Editing a Comment Close to Its Cell

Written by Allen Wyatt (last updated April 18, 2022)
This tip applies to Excel 2007, 2010, and 2013


21

Peggy has several cells in a worksheet that have comments associated with them. When she right-clicks on one of these cells, she can choose Edit Comment from the resulting Context menu in order to edit the comment. If the comment was one she created in a previous session with Excel, it is not unusual for the comment to open up elsewhere in the worksheet, sometimes several screens away. Peggy is wondering if there is a way to make the comment appear next to the cell it goes with.

This condition can be caused by several things. For instance, it is possible that while previously editing the comment, you clicked the comment box's border and dragged the comment to a different place on the worksheet. If you did this, then Excel remembers where the comment was moved to and always displays it in the remembered location.

Another common cause is that you do some filtering on your data, which results in some of the rows or columns being hidden while the filter is in place. If you then edit comments in the filtered cells, you have effectively "moved" the comment from the original location to a new location that is associated with the row or column visible on the screen. When you later remove the filter and try to edit the comment, it remembers where it was previously edited, and that is where the new editing opportunity takes place.

In both of these instances, the normal solution is to just grin and bear it—manually move the cells from where they are to where you want them. However, if you have this problem with a lot of cells, all the manual moving can be a real bother. In that case, you may want to use a macro to do the moving for you.

Sub MoveComments1()
    Dim cmt As Comment

    For Each cmt In ActiveSheet.Comments
        With cmt
          .Shape.Top = .Parent.Top
          .Shape.Left = .Parent.Offset(0, 1).Left
        End With
    Next cmt
End Sub

This macro moves all the comments in a worksheet so that their upper-left corner is the same as the upper-right corner of the cell to which they are attached. This puts the comments right next to their cells, which is where you want them.

If you would like to adjust all comments in an entire workbook, as well as "autosize" each of the comment boxes, then you can use this variation on the macro:

Sub MoveComments2()
    Dim wbk As Workbook
    Dim wks As Worksheet
    Dim cmt As Comment
    Dim rngC As Range
    Dim lArea As Long

    Set wbk = ActiveWorkbook

    On Error Resume Next

    For Each wks In wbk.Worksheets
        For Each cmt In wks.Comments
            With cmt
                .Shape.TextFrame.AutoSize = True
                If .Shape.Width > 200 Then
                    lArea = .Shape.Width * .Shape.Height
                    .Shape.Width = 200
                    .Shape.Height = (lArea / 200) * 1.1
                End If
                .Shape.Top = .Parent.Top
                .Shape.Left = .Parent.Offset(0, 1).Left
            End With
        Next cmt
    Next wks
End Sub

Note:

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 (9703) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Editing a Comment Close to Its Cell.

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

Saving in a Macro Using a Desired File Name

Need to save a new document, from within a macro, to a specific file name? If you use the Record Macro capabilities of ...

Discover More

Printing without Opening

Want to print one ore more workbooks without the need of actually opening the file? It's easy to do when you rely on ...

Discover More

Forcing Stubborn Recalculation

Have you ever recalculated a worksheet, only to notice that not everything calculated as it should? Here's a way you can ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Finding and Replacing Text in Comments

Excel allows you to add comments to individual cells in your workbook. Unfortunately, Excel doesn't provide a way to ...

Discover More

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

Inserting Workbook Comments Into a Cell

One of the pieces of information that Excel can maintain relative to a workbook is a set of comments of your choice. ...

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 4 + 9?

2022-10-24 12:08:50

Karen Prytula

Another reason why the comments move far away from their cell is because the column widths have been altered after comments were made.


2022-05-18 12:33:24

Cyndy K

Excellent solution, thank you!! I hide/unhide rows and columns all the time and the constantly moving comments were awful. FYI, to make this run much faster when you have lots of comments, turn off .Calculation, .ScreenUpdating, .DisplayStatusBar, .EnableEvents at start of macro, then turn back on at the end. (Thanks to https://www.computergaga.com/blog/6-ways-to-speed-up-your-excel-macros for the tip.)


2021-09-15 10:16:55

Rainer

Amazing !! Thanks a lot for sharing!


2020-08-28 10:31:16

J. Woolley

@glnz
These macros work for Unthreaded Comments, now called Notes. Also, see My Excel Toolbox: https://sites.google.com/view/MyExcelToolbox/


2020-08-27 11:20:35

glnz

Allen - in Excel in my Office 365 (now Microsoft 365), what used to be Comments are now "Notes". And they are wandering all over the place. Will your macros still work? Thanks.


2020-06-10 09:53:13

J. Woolley

My latest Comment macros are available at my new web site: https://sites.google.com/view/MyExcelToolbox/


2020-06-09 16:52:48

Andrei

Thank you, was very helpful.


2019-08-16 10:05:39

Amy

Excellent! Thank you


2019-08-06 09:46:14

J. Woolley

@Allan
You might be interested in these macros for managing comments; see ResizeComments:
http://www.contextures.com/excelcommentmacros.html


2019-08-05 12:58:12

Allan

My problem is that when I open a comment it is often contained in a giant box, much bigger than the one I first placed it in.
Solution anyone?


2019-08-05 03:13:19

Tony Collingwood

Great tip.


2018-11-13 18:16:28

Lyla Drayson

Excel 2016 - Works great, thanks!


2018-08-29 13:37:56

Peter T

From one who has been suffering from "Wandering Comment Syndrome" for years... thank you very much, this is excellent.


2018-08-11 11:04:08

J. Woolley

You might be interested in these macros for managing comments:
http://www.contextures.com/excelcommentmacros.html


2018-03-20 18:43:53

MalR

Great help!


2018-03-19 10:13:05

Chris Barker

Simple but brilliant solution that has 'tamed' a monster big spreadsheet for me thank you.


2015-08-18 06:15:51

Andrew

Thanks - works like a charm


2015-08-18 00:23:18

beje

verry helpfull. thanks a lot!


2015-08-17 10:52:34

Gary Lundblad

Nice! I too have had this problem.

Thank you!

Gary


2015-08-17 07:47:14

Brian Walker

Thank you! I have this problem often. It's one of my daily annoyances. Now it will be gone!


2015-08-15 07:50:02

Andrew Scott

I don't suffer this issue BUT I have a gantt chart style spreadsheet that I'd like to tag the end of the bars with a comment. The techniques here will help in this. Thanks


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.