Removing ability to delete comments in excel

  • I want to use comments in a spreadsheet to record changes to values in a variety of cells so am looking to remove the ability to delete any comments, so that the history of the changes remain. I've gone on line and searched and found the following code:


    Code
    Sub nocomments() 
        CommandBars("Worksheet Menu Bar").Controls("Insert").Controls("Comment").Enabled = False 
        CommandBars("Worksheet Menu Bar").Controls("Edit").Controls("Clear").Controls("Comments").Enabled = False 
    End Sub


    which then became


    Code
    CommandBars("Cell").Controls("Edit Comment").Enabled = False 
    CommandBars("Cell").Controls("Delete Comment").Enabled = False


    so I thought I could just remove the first line of the code, but this isn't working. I'm getting the following error:


    [FONT=&quot]Can't execute code in break mode


    then its - Invalid outside parameter.


    I'm not skilled enough to know how to sort so Can what I want be done and if so - what is the code required. Thanks[/FONT]

  • Re: Removing ability to delete comments in excel


    [QUOTE=skywriter;772594]Check out this thread.


    Thanks Bruce. I went and copied the code in Thread #9 and attached the code to the sheet I was wanting it actioned in. Ran the Macro and it didn't make any difference. I was still able to delete a comment.


    I don't know if I'm missing something here or my lack of VB knowledge is creating a hurdle here.......


    Cheers
    stu

  • Re: Removing ability to delete comments in excel


    Attach the workbook that's having the problem.


    Leave the code installed as is.


    No data needed since we're only concerned with deleting comments.


    I'm not sure you installed it in the proper place because you stated you ran the macro.


    You don't run event code it runs when the event triggers it.


    [sw]*[/sw]

    Bruce :cool:

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!