+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : How to set unprotect password to equal a cell value

  1. #1
    Registered User
    Join Date
    01-04-2010
    Location
    Charlottetown, PE
    MS-Off Ver
    Excel 2003
    Posts
    10

    Thumbs down How to set unprotect password to equal a cell value

    Hello,

    I would like to set the sheet unprotect VBA formula to use a cell value as the password to unprotect...purpose of this is I want to be able to edit that cell at anytime to update all instances of the "unprotect" password that are used over dozens of macros....

    I was trying,


    ----------
    Please Login or Register  to view this content.
    --------

    But when it locks, I can not unlock it using the value in B1....

    Any ideas?
    Last edited by Chaylon; 03-13-2010 at 10:33 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to set unprotect password to equal a cell value

    Hi Chaylon... Welcome to the forum. Be sure to read through the Forum Rules so you can use and follow them effectively. For instance, you'll need to EDIT that post above and put code tags around that code you used. (Like shown in my signature)

    =========
    Perhaps simpler would be to select the cell B1 in sheet1 and give it a NAME of PWord in the Name box. This "helps" disguise it's location, too.

    Then in your macro, simply refer to the named range:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    01-04-2010
    Location
    Charlottetown, PE
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: How to set unprotect password to equal a cell value

    Thanks a LOT! now I just have to go through all 80 some macros and update the VBA, lol

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to set unprotect password to equal a cell value

    Um, 80 macros?

    You should consider putting the variable into a Constant or a Global variable. Then update the macros to utilize the ONE variable you've declared for that purpose. Hopefully that results in less work to maintain the macros...

    Or perhaps you can use the CTRL-H (Replace) function to update all the macros at once...maybe.

  5. #5
    Registered User
    Join Date
    01-04-2010
    Location
    Charlottetown, PE
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: How to set unprotect password to equal a cell value

    Any way to fix this so that someone can't just type =pWord into any cell and it comes up with the password?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1