Adding Comments to Protected Worksheets

Written by Allen Wyatt (last updated May 17, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


3

Doug notes that Excel allows you to add comments to cells, but only if the worksheet is unprotected. He wonders if there is a way to allow the addition of comments in protected worksheets.

There are a few ways you can tackle this problem. The first is to simply modify how you protect your worksheet. Starting with an unprotected worksheet, follow these steps:

  1. Display the Home tab of the ribbon.
  2. In the Cells group, click Format | Protect Sheet. (You could also click the same tool on the Review tab of the ribbon.) Excel displays the Protect Sheet dialog box. (See Figure 1.)
  3. Figure 1. The Protect Sheet dialog box.

  4. Enter a password to be used in protecting the worksheet.
  5. Scroll down in the list of permissions and select the Edit Objects check box. (Comments are considered objects in Excel.)
  6. Set any other permissions desired.
  7. Click OK to dismiss the dialog box. If you provided a password in step 3 you are prompted to reenter it, which you should do.

Any worksheet user can now add comments to cells. Note that this allows them to add comments to any cells in the worksheet, not just to those cells that you've formatted as unlocked. In addition, users can also modify (add, change, or delete) any other objects in the worksheet, such as drawings and charts.

If you want a more granular approach to dealing with comments in protected worksheets, then you'll need to resort to using a macro. The concept is to have the macro prompt the user for the comment text, unlock the worksheet, insert the comment, and then relock the worksheet.

Public Sub InsertComment()
    Dim sPassword As String
    Dim MyComment As String

    sPassword = "123"

    Set commentCell = ActiveCell
    MyComment = InputBox("Enter your comments", "Comments")

    ActiveSheet.Unprotect Password:=sPassword
    Range(commentCell.Address).AddComment
    Range(commentCell.Address).Comment.Text Text:=MyComment
    ActiveSheet.Protect Password:=sPassword
End Sub

Change the value assigned to the sPassword variable; this is required to unlock and relock the worksheet. Since you are storing the password in the macro, you'll also want to make sure that you take steps to protect the macro (put a password on the VBA module) so others cannot see the password. The macro can be assigned to a shortcut key or added to the Quick Access Toolbar.

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 (12928) 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

Counting Cells According to Case

Text placed in cells can either be lowercase, uppercase, or a mixture of the two. If you want to count the cells based ...

Discover More

Controlling the Italic Text Attribute

If you are formatting your document by using a macro, you may need to make some of your text italics. You do that by ...

Discover More

Copying All Tables to a New Document

Need to make a copy of every single table in a document? There's a quick and easy way to do it using the macro in this tip.

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (ribbon)

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

Linking Comments to Multiple Cells

In Excel, single comments are associated with single cells. If you want to have a comment be linked to multiple cells, ...

Discover More

Viewing Comments

There are three different ways that Excel allows you to display any comments that are in your worksheet. Here's how you ...

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 8 - 5?

2022-03-16 09:57:35

J. Woolley

@Ewald Eppink
To remove a Comment, right-click the cell and pick Delete Note. Comments are now called Notes.


2022-03-15 06:57:55

Ewald Eppink

When adding comments to a specific cell and then using the <Esc>-key you get an error.
Do you have a solution for this?
And is it possible removing comments?


2019-11-23 09:35:04

John Mann

I have the Protect/|Unprotect command on my QAT. I use cell locking and sheeet protection extensively to protect myself from inadvertantly editing or adding data where it's not supposed to be. Since I'm only protecting against myself, a password is an unnecessary extra step. I also make frequent use of cell comments (and to make them more obvious I use a different font colour for cells with comments).

A macro stored in my personal workbook, to make it universally available would be nice. However, the macro suggested, if I'm reading it correctly, recquires a password, which I don't want to use. I could probably figure out how to avoid this by recording a macro of locking or unlocking a cell, then reading the code and using that to guide me in modifying the macro above.


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.