Close Window   
Free Ebook
Get Your Free Excel
Our Top 15 Excel Tutorials
Instant Access!
Subscribe for Free Excel tips & more!

Lost My Password (worksheet Protect)

Forum Register
Search Excel Forum Posts, Tutorials, Macros, Tips, and More

Is there any way to hack out a password on a worksheet? I
forgot the password I used to protect a sheet?! I'm dying
here, I spent hours creating this file with complex macros
and calculations; now I cannot unlock and work on it!!

Any help is greatly appreciated.
Dan Winterton

View Answers     

Similar Excel Tutorials

Protect and Unprotect All Worksheets at Once
This will allow you to protect or unprotct all worksheets in a workbook at once. It doesn't allow you to input a p ...
Password Protect Excel VBA Macros
How to password protect VBA code and macros in Excel so that a user cannot see the code or edit it or do anything ...
Password Protect Excel Files
How to keep an Excel workbook safe by encrypting it with a password. This will make it so that a user cannot open ...
Prevent a User from Changing Any Data in Excel
I'll show you how to lock a spreadsheet so that nothing can be changed in it. This is a great feature to use when ...

Helpful Excel Macros

Protect and Unprotect All Worksheets at Once
- This will allow you to protect or unprotct all worksheets in a workbook at once. It doesn't allow you to input a passwor
Hide Formulas in a Worksheet and Prevent Deletion
- This macro will hide all formulas within a workbook and not allow them to be deleted. The page will not be protected li
Hide Comments in Excel Completely - Even Indicators Will not Appear
- Hide all comments in an Excel workbook. No indicators will be displayed and comments will not appear when you hover ove
Automatically Run a Macro so Many Seconds, Minutes, or Hours After an Excel Workbook has been Opened
- Run a macro after a certain amount of time has passed since the Excel workbook was opened. This means that you can set
Save the Current Worksheet as a New File in the Current Folder
- This Excel Macro saves the currently visible worksheet into the SAME folder as the current file. It is different from

Similar Topics

I've searched the forum but can't seem to find this, only questions on how to unlock them...

I have 1 worksheet in the workbook I want to password protect. I've tried some VBA code I found but it didn't seem to do anything at all.

The Sheet is Sheet5 and titled "Misc"... Is there a way to just password protect this sheet?

I should add that I want to password protect the worksheet from being viewed, not from being edited. Is that possible?

I am creating a macro is supposed to password protect a worksheet and then hide it.

I recorded the macro including entering a password. When I went to test the macro, it protected the sheet without setting a password at all.

I dont care if I have to manually enter the password or if it uses the password that i put in the macro, but at this point it doesnt password protect at all.

Anyone have any thoughs on how to correct this?

Need someone's help

I'm trying to unlock a worksheet that has been protected with a password. I used xyz as my password example

So far I have used the following 3, but none of these will work


Workbook.Unprotect (xyz)
Worksheets("My Menu").Unprotect Password:=(xyz), Scenarios:=True
ActiveSheet.Unprotect (xyz)

sure could use some help. I used this many years ago, but I've forgot how to do it.


I'm using excel to generate a worksheet which when printed is an auditable form, this is sent as an attachment to an email recipient. Currently I copy my worksheet into a new workbook and protect it from interference by protecting with a password that the recipient doesn't have then I save it and attach it. I've run macro recording but the password protection doesn't seem to transfer and the recipient is allowed to unprotect the sheet.
How can protect the worksheet automatically from a userform and ensure that the password property transfers to the recipient?


When I email my project from work to home the macros enabled password falls off! any ideas why.



Hi everybody,

I have a doubt regarding macros. Is it possible to create a macro able to protect one worksheet with a specific password?
When I record a macro to protect the sheet it does protect it, but without any password.

I have to unprotect sheets, do some changes and after that protect it again with the same password...

Thanks a lot for the help!

I am creating a spreadsheet with multipl worksheets (12 to be exact, one for each month). On the 7th of the month after the worksheet locks for user editing. (2/7/2011 the January worksheet was locked). I do this by protecting all the sheets before close and then at open call for protectsheet to do a date check and unprotect the necessary tables. In the unprotected sheets I need to lock columns E, H, K and L. I am wondering is I should change a code or add something to do this and I can't figure out what to do. Any help would be greatly appreciated.

Workbook code currently being used:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheets("Jan").Protect Password:="Secret"
Sheets("Feb").Protect Password:="Secret"
Sheets("Mar").Protect Password:="Secret"
Sheets("Apr").Protect Password:="Secret"
Sheets("May").Protect Password:="Secret"
Sheets("Jun").Protect Password:="Secret"
Sheets("Jul").Protect Password:="Secret"
Sheets("Aug").Protect Password:="Secret"
Sheets("Sep").Protect Password:="Secret"
Sheets("Oct").Protect Password:="Secret"
Sheets("Nov").Protect Password:="Secret"
Sheets("Dec").Protect Password:="Secret"
End Sub

Private Sub Workbook_Open()
Call ProtectSheet
End Sub

Sub ProtectSheet()
    If Now() < DateSerial(2011, 2, 7) Then
            Sheets("Jan").Unprotect Password:="Secret"

    End If
    If Now() < DateSerial(2011, 3, 7) Then
            Sheets("Feb").Unprotect Password:="Secret"

    End If
    If Now() < DateSerial(2011, 4, 7) Then
            Sheets("Mar").Unprotect Password:="Secret"

    End If
    If Now() < DateSerial(2011, 5, 7) Then
            Sheets("Apr").Unprotect Password:="Secret"

    End If
    If Now() < DateSerial(2011, 6, 7) Then
            Sheets("May").Unprotect Password:="Secret"

    End If
    If Now() < DateSerial(2011, 7, 7) Then
            Sheets("Jun").Unprotect Password:="Secret"

    End If
    If Now() < DateSerial(2011, 8, 7) Then
            Sheets("Jul").Unprotect Password:="Secret"

    End If
    If Now() < DateSerial(2011, 9, 7) Then
            Sheets("Aug").Unprotect Password:="Secret"

    End If
    If Now() < DateSerial(2011, 10, 7) Then
            Sheets("Sep").Unprotect Password:="Secret"

    End If
    If Now() < DateSerial(2011, 11, 7) Then
            Sheets("Oct").Unprotect Password:="Secret"

    End If
    If Now() < DateSerial(2011, 12, 7) Then
            Sheets("Nov").Unprotect Password:="Secret"

    End If
    If Now() < DateSerial(2012, 1, 7) Then
            Sheets("Dec").Unprotect Password:="Secret"

    End If
End Sub

I was messing around trying to password protect a spreadsheet and i forgot the password. Are there any options I have. I forgot how i did some of the formulas and was hoping not to do it all over again.

The following code is what I have at this time to password protect an individual file when it is open.
When I run it it simply pops up a screen asking me to enter the password I want to protect the file with, I enter the file then click ok.

Sub Protect_sheets()
    Dim wSheet          As Worksheet
    Dim Pwd             As String
    Pwd = InputBox("Enter your password to protect all worksheets", "Password Input")
    For Each wSheet In Worksheets
        wSheet.Protect Password:=Pwd
    Next wSheet
End Sub

What I'm looking for is a a code that instead when run I want to 1st prompt me to select a directory and once selected have a 2nd prompt asking me to enter the password of my choice then lastly open each file within the chosen directory, protect it using the password just entered and saved. Can anyone assist?

Hi there

Is there a way to password protect a worksheet using VBA?

I'm trying to password protect a sheet with the password "coffee".

However when I record and run a a macro to do this, the sheet is protected but without a password. Ie the VBA code does not state that the password must be coffee, it just protects the sheet without a password.

Below is the code the code generated by the macro:

ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

I was wondering if it is possible to run a macro that will unlock a password protected worksheet do its task and then protect the worksheet with a password

Test Macro
ActiveSheet.Unprotect "cbre" this is the unlocking password which works when the macro is ran for the first time but after that the password is not necessary as the macro does not re enter the password at the end of the macro
Application.CutCopyMode = False
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFormattingCells:=True, AllowInsertingRows:=True, _

Thanks for the help


I am trying to password protect a range of cells on a worksheet and it won't work. I go through the motions of setting up the range, setting the password and then protecting the sheet, but it then allows editing without requiring a password. The sheet does have macros that hide and unhide some rows and columns. Will this impact the protect range function? Any Ideas?

Have created button that takes a series of worksheets for one month and converts the information into a new month (w/blank cells). I am trying to include in macro for sheet to protect with the password, "controL" -- I can get it to unprotect the original w/the password, and to re-protect the worksheet (w/the entry below) -- however can't get it to re-protect w/password. HELP!!??

ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowFormattingRows:=True

Hello Everyone. I am using Excel 2007 and I cannot get my table to allow filtering when my worksheet is password protected. I recorded a macro to unprotect the worksheet, sort the table, then protect the worksheet again. My problem is that when I protect the sheet again, I lose the ability to filter the table even though the macro includes the following code when it protects the sheet again.

ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, AllowFiltering:=True

By trying different things I have found that if I password protect the sheet BEFORE the above code, filtering still works but the page is no longer password protected. It is simply protected (without a password). If I password protect the sheet after the above code, the sheet is password protected, but then I cannot filter the table.

Is there some way to allow filtering AND to have the sheet password protected?


I'm running some macros where I need to unprotect my worksheet, run the rest of the code, and then protect the worksheet again and allow Objects to be edited.

So I have...

ActiveSheet.Unprotect Password:="password'


ActiveSheet.Protect Password:="password"

Which all works fine and dandy, but I don't know how to get it to allow the editing of objects. Can anyone help?



ActiveSheet.Protect Password:="pass"
ActiveSheet.Unprotect Password:="pass"

I needed the above code in my VBA. User don't have access to VBA code.

I have LOCK button and UNLOCK button. When user unlocked it and trying to redefine a worksheet password using Review tab > Protect Sheet instead of clicking my buttons, things get messy. Because "pass" is the password in vba code, where new password has been changed by the user.

How do you handle this type of scenarios?

Hi all
May be a simple answer but...

I have a spreadsheet in which I need to protect 2 columns, B & D.
D needs to be protected so that it is uneditable.

B needs to be protected by a password so that it can be edited but only by password, this is to keep control of information.

I know how to password protect a column of cells but the problem is once you have typed in the password the entire column is unprotected.

Is there a way to protect each individual cell with a password or make it so the password protection locks the column again after the cell has been edited?

Any help greatly appreciated once again..

Hi guys,

I have protected my sheet with a password. Tools > Protection > protect sheet.
The protection is no changes and only unlocked cell can be accessed.

The problem is that I forgot my password. I know thats very stupid and it won't happen again.

Is there a solution to bypass the sheet protection or to disable it without knowing the password?

thnx in advance for help.

I have a macro that updates 5+ pivot tables and protects the sheets so users can not drill into the details or copy and paste the information, but I need them to be able to use the Pivot Table Filters to view summary info for their Region or their Plants.

I've seen numerous threads providing Macros that password protect multiple sheets at a time, but I can not seem to figure out how to allow the users of the worksheet to "Use Pivot Tables reports", which is a checkbox option in the "Protect Sheet" screen.

The portion of the Macro I am currently using to protect the sheets is:

Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Protect Password :=" revenue "
Next ws

Any help would be greatly appreciated.


ActiveSheet.Protect Password:="hi"
ActiveSheet.Unprotect Password:="hi"

Here I assign password using VBA. It is hardcoded.

My users won't have access to vba code. Some user will unprotect worksheet and will protect worksheet using new pass. The above code wont allow that. I can't use a named range to define pass in cell because it needs to be hidden from most users.

Is there any system level global type variable that returns worksheet passwords?

ActiveSheet.Protect Password:=Worksheets("LockedSheet").SheetPass

I am assuming SheetPass stores password for the worksheet. This password was entered by user from Review>Protect Worksheet.

Is there something to do this?



I want to know how to password protect the excel tab. I know how to protect the sheet so that nobody can change or edit my calculations but how do I protect the tab so that people would not be able to open certain tabs at all?
I know how to hide the tab but then I need to have a password in order to unhide it or open. Can someone help? I know it can be done since I have seen reports with hidden tabs that required password to open them.



I have been looking through the message board and cannot find a macro to help me. I am looking at something I hope very simple.

I need a macro that I can have in any workbook enabling me to protect / unprotect the workbook that I have currently opened with a set password (let say "Password")

I would link this macro to a button in excel 2002. I have try the following but it doesnt work

Would it be possible that the button (first) works (second) understand whether or not protect / unprotected and do the opposite?

Sub Protect
Activeworkbook.protect password:="password", structu =FALSE, Windows:=false
End Sub

Your help is greatly appreciated

I have created a workbook with one worksheet. I will need to make changes to this on a regular basis, so am building code that will allow me to input a password to unprotect the worksheet and workbook to allow for changes.

I also want the button to relock the sheet when pressed a second time. Basically I need this:

If Worksheet is protected then prompt password box and if correct unlock. If worksheet is unprotected then protect with xyz password. I can do all the actions EXCEPT the first if statement. There is no property that I am aware of that allows you to evaluate the protection of a worksheet to true or false.

My thoughts were something like this:

If Worksheet("xyz") = True Then...


If ActiveWorkbook.Protect = True Then...

None of these ideas work, but no error is generated either. Any thoughts? Thanks,


Here is what i am trying to do. i have a worksheet that i would like to protect with a password. In the worksheet there are several macros, (1) that runs
when i open the work sheet. I have it now to where when i open
the worksheet it prompts me for the password, i enter the password
and it runs the macro and then protects the sheet back, which
is what i want, but I do not want to enter a password everytime I
open this worksheet or employees who will also be accessing this worksheet.
Is there anyway to do this without typing the password everytime the
sheet is opened.

I am trying to write some code in Private Sub Worksheet_Change sheet module that will unlock and lock cells depending if they are blank or not.

I have got this far:

'to unlock H
If Not Intersect(Target, Range("B11:B81")) Is Nothing Then
ActiveSheet.UnProtect Password:="PASSWORD"
Cells(Target.Row, "H").Locked = False
ActiveSheet.Protect Password:="PASSWORD"
End If

'to lock H
If Intersect(Target, Range("B11:B81")) Is Nothing Then
ActiveSheet.UnProtect Password:="PASSWORD"
Cells(Target.Row, "H").Locked = True
ActiveSheet.Protect Password:="PASSWORD"
End If

So basically, if something is entered in the cell range B11 to B81, then unlock the cells H, if there is nothing in the call range B11 to B81 then lock the cells H.

What this seems to do is unlock and lock H at the same time and doesnt matter if the cell range is empty or not.

Has anyone got any ideas on how to resolve this please?

Many thanks for any suggestions supplied to my post.

As in my in my heading i need to get a macro to password protect my sheet.

i have achieved this but if i change the name of the workbook or copy it and then try to unlock the sheet it dose not ask me for a password it just unlocks the sheet

any ideas ?

thank you