Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Sep 2001
    Location
    Blue Springs, Missouri, USA
    Posts
    108
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Comments & Protection (XL2000)

    I have this spreadsheet that several folks use. Some of the cells are locked and some aren't. When I turn on protection, it is not possible to put a comment in an unlocked cell. Is there a way around this?

    Thanx..

    Dennis

    <img src=/S/gramps.gif border=0 alt=gramps width=20 height=20>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Comments & Protection (XL2000)

    You'll have to unprotect the sheet, insert a comment and then re-protect it. Here is some code that will do that; probably one of the Excel-guru's will come up with a better version.

    Sub InsertComment()
    Dim strComment As String
    Dim cmt As Comment
    On Error GoTo Err_Handler
    ActiveSheet.Unprotect
    On Error Resume Next
    strComment = ActiveCell.Comment.Text
    On Error GoTo Err_Handler
    If strComment <> "" Then
    Set cmt = ActiveCell.Comment
    Else
    Set cmt = ActiveCell.AddComment
    End If
    strComment = InputBox("Enter your comment here", , strComment)
    If strComment <> "" Then
    cmt.Text strComment
    End If
    Exit_Handler:
    ActiveSheet.Protect
    Set cmt = Nothing
    Exit Sub
    Err_Handler:
    MsgBox Err.Description, vbExclamation
    Resume Exit_Handler
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •