Almost done!!!

  • Denni,
    Everything look pretty nice!!
    Now when I protected the worksheet and when I'm trying to run the macro it getting me an error because the protection.
    Is there any way to unprotect the worksheet from the macro and protect the worksheet again from the macro after the macro is done?
    Note: It is protected with a password.

    One more time thanks a lot!


    Marcelo.

  • Hi Marcelo


    You could use



    The On Error Statement is just in case your code 'bugs out' and would leave the sheet unprotected.



    There is also the UserInterfaceProperty of the Protection Method that would allow your code to act on a Protected sheet. I urge you to read the VBA help on this before using it though.

  • Marcelo,


    This protection problem is exasperating.
    I have encountered the same protection problem you have described. I incorporated this statement in the worksheet module:

    ActiveSheet.Protect UserInterfaceOnly:=True, Password:="password"


    and I still receive the error message "Run-time error '1004': the cell or chart you are trying to change is protect and therefore read-only", each time I run my macros.

    You indicated that you had placed your protection statement in the wrong place. Where??? I trying to determine if I have made a similar error.


    Also, did you wind up using the suggestion supplied by Dave Hawley? If so did it work for you?


    Thanks,
    Chris

  • Chris,
    The code from Dave work fine. and I just put these codes (desactivate password) in the beginning macro after the Sub() and the activate password in the end before the end Sub:
    Example:
    Your SUB() name macro
    Sheet1.Unprotect Password:="Secret"


    [your codes]


    Sheet1.Protect Password:="Secret"


    End sub ,of you macro name