ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Insert comment in protected worksheet (https://www.excelbanter.com/excel-worksheet-functions/29431-insert-comment-protected-worksheet.html)

The Tuner

Insert comment in protected worksheet
 
What are the correct settings that will allow a user to insert a cell comment
in an unprotected cell of a protected worksheet? When the worksheet is
protected, the insert comment function is not available (greyed out).

Jason Morin

You could have the user run this macro. The major drawback is that if a user
wishes to edit an existing comment, they can't. They'd have to insert a new
comment over the old one:

Sub InsertComment()
Dim strPassword As String
Dim strCommText As String
Dim strMsg As String
Dim strMsg2 As String
Dim nMsgResp As Long
Dim strOldComm As String

strPassword = "apple" 'change to your password
strMsg = "Comment already in cell! Do you want to insert a new comment?"
strMsg2 = "Insert text for comment in "

With ActiveCell
If Not .Comment Is Nothing Then
strOldComm = .Comment.Text
nMsgResp = MsgBox(strMsg, vbYesNo)
If nMsgResp = vbYes Then
.Comment.Delete
GoTo NewComment
Else
Exit Sub
End If
Else
NewComment:
strCommText = InputBox(strMsg2 & .Address(False, False) & ":")
ActiveSheet.Unprotect Password:=strPassword
.AddComment
If strCommText = "" Then
.Comment.Text Text:=strOldComm
Else
.Comment.Text Text:=strCommText
ActiveSheet.Protect Password:=strPassword
End If
End If
End With

End Sub

---
HTH
Jason
Atlanta, GA


"The Tuner" wrote:

What are the correct settings that will allow a user to insert a cell comment
in an unprotected cell of a protected worksheet? When the worksheet is
protected, the insert comment function is not available (greyed out).


Dave Peterson

If you allow the users to "Edit objects"

In xl2002+
Tools|protect|protect sheet
there's a list of things that you want to allow the users to do.

If you check "edit objects", then they can insert comments (and do other things
to other objects--pictures, buttons...)

In xl2k and before, I think there's an checkbox on that dialog.

The Tuner wrote:

What are the correct settings that will allow a user to insert a cell comment
in an unprotected cell of a protected worksheet? When the worksheet is
protected, the insert comment function is not available (greyed out).


--

Dave Peterson


All times are GMT +1. The time now is 10:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com