• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Set Password using value of named range

Cammandk

Member
How can I use the value of a cell to be the password name in my code.

If the value in A1 is "Password" and this is named as "PW1" how can this be placed in the code

Sheet1.Protect Password = "PW1"

Thank
DK
 
Hi, Cammandk!
Have you tried looking into the VBA built-in help? If not, in the immediate window (if not visible press Ctrl-G) type Protect, click on what typed and press F1.
Regards!
 
Worksheets("Sheet1").Protect Password = [PW1]

You will need to use
Worksheets("Sheet1").Unprotect Password = [PW1]
to unprotect the sheet
 
Hi Hui

I had found a solution - 'Sheet28.Unprotect Password:=CStr(Sheets("CMSetup").Range("PWFloats").Value)

Yours is much more elegant.

Thanks
[SOLVED]
 
Back
Top