+ Reply to Thread
Results 1 to 4 of 4

Add unprotect and protect password to Macro

  1. #1
    Registered User
    Join Date
    05-24-2014
    Posts
    34

    Add unprotect and protect password to Macro

    Currently my Macro ask the used for a password. I would like the Macro to enter the password without the user being involved. What do I need to add to have it unprotect and protect the sheet on its own?

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    05-24-2014
    Location
    Denver, Colorado
    Posts
    9

    Re: Add unprotect and protect password to Macro

    Try this.

    Activesheet.Unprotect Password:="password"
    Activesheet.Protect Password:="password"

    Cheers.

  3. #3
    Valued Forum Contributor
    Join Date
    09-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    324

    Re: Add unprotect and protect password to Macro

    Your code updated. edit this line for the password mypassword = "Put Password Here"

    Please Login or Register  to view this content.


    Shelton A.
    If Helpful, Add Reputaion!

  4. #4
    Registered User
    Join Date
    05-24-2014
    Posts
    34

    Re: Add unprotect and protect password to Macro

    Well I made it work before you your comment payaller.
    I used macspie info but I deleted:
    DrawingObjects:=True, Contents:=True, Scenarios:=True _

    , AllowSorting:=True, AllowFiltering:=True, AllowUsingPivotTables:=True

    To make it work.... will that effect anything important? Seems to run fine so that

    Ended it like this

    End With
    ActiveSheet.Protect Password:="password"

    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 03-12-2013, 02:33 AM
  2. VBA to Unprotect (w/ password), Unhide, Hide, and Protect (w/ password)
    By pger34 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-14-2012, 12:35 PM
  3. FIXED - MAcro to protect/unprotect sheets based on password in cell
    By pmcook1979 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-10-2012, 04:28 AM
  4. Macro to protect/unprotect with password
    By Cam in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-26-2005, 06:05 PM
  5. [SOLVED] Re: Password - Protect, UnProtect
    By Jeff in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-19-2005, 04:06 PM

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