+ Reply to Thread
Results 1 to 6 of 6

Macro to Unprotect sheet!?

  1. #1
    Registered User
    Join Date
    01-10-2006
    Posts
    67

    Macro to Unprotect sheet!?

    Hello I'm quite stuck, I'm trying to create a macro while the worksheet is protected and the thing is i click unprotect and the password dialogue box appears asking me to enter password which is fine, but can i create a macro so that when it is played it opens this dialogue box for me to enter password to unprotect sheet?

    Thanks a lot
    From John

  2. #2
    Forum Expert swatsp0p's Avatar
    Join Date
    10-07-2004
    Location
    Kentucky, USA
    MS-Off Ver
    Excel 2010
    Posts
    1,545
    try this:

    Please Login or Register  to view this content.
    If you want to assign this to a button, uncomment the Private Sub line and comment out (or remove) the Sub line.

    HTH

    Bruce
    Bruce
    The older I get, the better I used to be.
    USA

  3. #3
    Registered User
    Join Date
    01-10-2006
    Posts
    67
    I dont understand ...what do you mean?

    do i need to use VB code for it?

    Thanks a lot
    From John

  4. #4
    Registered User
    Join Date
    01-10-2006
    Posts
    67
    Any help to create a macro to unprotect worksheet but before it does to pop up the dialogue box asking user to enter password to unprotect worksheet?

    I need help pleasee
    Thanks a lot
    From John

  5. #5
    Forum Contributor
    Join Date
    11-20-2005
    Posts
    256
    Quote Originally Posted by Neo1
    Any help to create a macro to unprotect worksheet but before it does to pop up the dialogue box asking user to enter password to unprotect worksheet?

    I need help pleasee
    Thanks a lot
    From John
    Hi Neo1,

    It sounds like you want the sheet to automatically unprotect with a password.
    If this is so, Just add to Bruce's code for the password.

    Put this in the Module for the sheet in question.
    Right Click on the worksheet tab and select "View Code".
    Paste the folowing code there. Don't forget to replace your password where it says "your password goes here"

    Private Sub Worksheet_Activate()
    ActiveSheet.Unprotect Password:=your password goes here
    End Sub

    Same thing without a password:

    Private Sub Worksheet_Activate()
    ActiveSheet.Unprotect
    End Sub
    Last edited by Desert Piranha; 03-27-2006 at 11:21 PM.
    Thx
    Dave
    "The game is afoot Watson"

  6. #6
    Registered User
    Join Date
    01-10-2006
    Posts
    67
    yeah ok thanks...but how do i apply it to a button so that whenever i need to click the unprotect button for the sheet....

    and also how can i make it so that each worksheet has a different password to unprotect it?

    Thanks a lot
    From John

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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