Consulting

Results 1 to 7 of 7

Thread: Solved: INSERT CELL COMMENTS IN PROTECTED SHEET

  1. #1
    VBAX Contributor
    Joined
    Dec 2006
    Posts
    193
    Location

    Solved: INSERT CELL COMMENTS IN PROTECTED SHEET

    Is it possible to allow a user to insert cell comments on a protected worksheet?

    THANKS

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    You'll need to create a macro to open an inputbox for the comment, unprotect the sheet, add the comment and then reprotect.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    Or use the UserInterfaceOnly:=True argument and protect the workbook in the Workbook_Open event - then your code can run freely on the worksheet without having to unprotect and reprotect the sheet.
    Regards,
    Rory

    Microsoft MVP - Excel

  4. #4
    Administrator
    Chat VP VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    or for the worsheet protection you can use protect scenarios and contents only (i.e. leave 'objects' unchecked)
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  5. #5
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    323
    Location
    Hello all, I would also like to be able to access the comment tools on a protected sheet but am unable to do so.

    Rory I tried your way but it doesn't allow access to comments. I used the following:
    [vba]
    For Each wksh In Worksheets
    wksh.Activate
    Range("a1").Select
    wksh.Protect password:="pword", userinterfaceonly:=True
    Next wksh
    [/vba]

    I also tried:
    [vba]
    wksh.Protect password:="pword", drawingobjects:=false
    [/vba]
    and
    [vba]
    wksh.Protect password:="pword", scenarios:=false
    [/vba]

    But these lines unprotect everything.


    Md, I didn't try your method with the input boxes. The only way I would like to use this method is to be able to add this to the menu that pops up when you right click. Is this possible?

    Thanks
    Gary

  6. #6
    Administrator
    Chat VP VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    try
    [VBA]
    wksh.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
    True
    [/VBA]
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  7. #7
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    323
    Location
    Thank you Jonske that worked. It works with "userinterfaceonly:=True" in or out. Should I put it in or leave it out?

    Thanks
    Gary

Posting Permissions

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