Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Jun 2006
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unprotect Worsheet to run Macro (2000 SR-1)

    I currently have a sort macro that runs when the worksheet is clicked on to view (activate). However, I would like to password protect the worksheet as it is all formula based and therefore every cell would be locked. Is there a way to temporarily unlock the worksheet when a user clicks on it to run the sort macro and then lock it again? I would want it to remain password protected.

    ck

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Unprotect Worsheet to run Macro (2000 SR-1)

    Add the line:
    Activesheet.Unprotect "password"

    at the beginning of the code to unprotect the sheet (change the password as desired) and then add the line:

    ActiveSheet.Protect "password"

    At the end of the code to reprotect it when it is done.

    Steve

Posting Permissions

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