Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Arlington, Texas, USA
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Password Protection (Excel 2000 SR1a)

    I have a spreadsheet that is password protected (not to open but to stop modification), but I need to allow the user to sort a particular range. I created a command button that unprotects the sheet, sorts the required range, and then re-protects the sheet. However it asks for the password to unprotect the sheet. What can I had to the VBA code to programatically provide Excel with the password during the execution of this code? and then re-protect the sheet again using the password.

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Password Protection (Excel 2000 SR1a)

    Generally:

    Worksheets("Name").Unprotect Password:="Password"
    <sort code>
    Worksheets("Name").Protect

    I don't remember, but Excel 2000 may have a password protection option that permits sorting, so you could set the worksheet protection at that level.
    -John ... I float in liquid gardens
    UTC -7ąDS

  3. #3
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Arlington, Texas, USA
    Posts
    124
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Password Protection (Excel 2000 SR1a)

    Thanks a bunch your suggestion worked fine.

    shihalud

Posting Permissions

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