Share via

'Insert comment' facility in protected spreadsheets gets deactivated.

Anonymous
2010-07-05T05:35:47+00:00

When we protect a worksheet using password, insert comment option gets deactivated. Can we do something to use same in protected sheets too. Actually this option should also be made optional while saving a sheet like what we have asked for selecting unlocked cell,selecting locked cell, formatting cells,formatting column,formatting rows, and many others when we protect sheets using..tools-protection-protect worksheet.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2010-07-05T09:30:22+00:00

I found that adding comments to cells using vba on a protected spreadsheet was a bit tricky (as the UserInterfaceOnly property of the protect method didn't seem to work with the .AddComment Method), perhaps one of the MVPs knows a way around this, in the meantime, here's my attempt:

Private Sub CommandButton1_Click()

'Unprotect the sheet using your password

Sheet1.Unprotect Password:="enteryourpasswordhere"

'Clear the comments on the target cell

' - this prevents errors when adding comments to a cell that already contains comments.

Range("A1").ClearComments

'Add a comment to the cell

Range("A1").AddComment ("This is my comment")

'Or as an alternative example you can use:

'Range("A1").AddComment (Range("A2").Value)

'Reprotect the sheet using your password

Sheet1.Protect Password:="enteryourpasswordhere"

End Sub

The big downside to this code is that it contains your sheet protection password, so you'd have to lock the VBA Project for viewing.

Essentially this code adds a comment to cell A1, the second option adds the value of cell A2 as a comment to cell A1.

Was this answer helpful?

0 comments No comments

Answer accepted by question author

Anonymous
2010-07-05T06:44:05+00:00

Insert Comment is controlled by the Edit Objects checkbox in the Protect Sheet dialog's list.

Check that box and you will be able to insert comments (and also do things to other objects).

There is no options specifically aimed at comments.  If you don't want the full effect of Edit Objects you would need to write a macro to set the comment up for you.


Bill Manville. Excel MVP, Oxford, England. www.manville.org.uk

Was this answer helpful?

0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2010-07-07T14:05:33+00:00

    .....then can I ve that particular macro please for Insert comment only .

    Use the macro recorder to 1) unprotect the worksheet, 2) insert a comment, and 3) re-protect the worksheet.  You can then modify it to work with the activecell or share it here and someone can show you how to modify it.


    Tushar Mehta (Technology and Operations Consulting)

    www.tushar-mehta.com (Excel and PowerPoint add-ins and tutorials)

    Microsoft MVP Excel 2000-Present

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2010-07-07T13:30:46+00:00

    Thx but its not useful.........

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2010-07-05T06:54:14+00:00

    .....then can I ve that particular macro please for Insert comment only .

    Was this answer helpful?

    0 comments No comments