Log in  \/ 
x
or
x
x
Register  \/ 
x

or

How to recover lost worksheet protection password in Excel?

We always set passwords to protect some important worksheets from being destroyed or modified by others. But if you forget your passwords, how could you do? Fortunately, Excel supports some VBA code to recover your lost worksheet protection password. You can deal with this problem as this:

Recover lost worksheet protection password in Excel with VBA code
More tutorial for protecting worksheet...


Recover lost worksheet protection password in Excel with VBA code

The following VBA code can help you to quickly cancel your original passwords in a worksheet.

1. Open your worksheet which has been protected before.

2. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.

3. Click Insert > Module, and paste the following code in the Module Window.

VBA code: recover lost worksheet protection password

Sub PasswordRecovery()
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126
ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & _
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
If ActiveSheet.ProtectContents = False Then
MsgBox "One usable password is " & Chr(i) & Chr(j) & _
Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _
Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
Exit Sub
End If
Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next
End Sub

4. Then click F5 key to run this code, and a prompt box will pop out, click OK to close it, and your passwords of the protected worksheet will be canceled at once.

Notes:

1. With this code, you just only recover one worksheet protection password at a time, if there are multiple protected worksheets, you need to apply this code one by one.
2. The above code comes from http://excelzoom.com/2009/08/how-to-recover-lost-excel-passwords/.


Easily protect multiple worksheets at the same time with password in Excel:

The Protect Worksheets utility of Kutools for Excel can help you protect multiple worksheets in bulk with the same password. It also provides the utility to unprotect these worksheets at the same time. Download the full feature 30-day free trail of Kutools for Excel now!


Related articles

How to protect multiple worksheets at once in Excel?

How to unprotect multiple worksheets at once in Excel?


The Best Office Productivity Tools

Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    tiffany.cannagle@gmail.com · 20 days ago
    I have tried, but the module class is not active. Can you help?
  • To post as a guest, your comment is unpublished.
    Ken · 2 months ago
    while i open my protected file, it ask me for the password. then i click Alt-F11, but no VBA window pop up. Please advise how can i reset my password or open the protected file.

    leungchinto888@yahoo.com.hk
  • To post as a guest, your comment is unpublished.
    suranga · 6 months ago
    Thank you so much. Great Work Appreciate you
  • To post as a guest, your comment is unpublished.
    Chris · 6 months ago
    I have lost the password to my Excel workbook. Every time a click to open the file, a pop up box is displayed that the file is protected however the password I enter is always incorrect, then I get a message "the password you supplied is not correct. Veryfied that the caps lock key is off and made sure to use the correct capitalization. I really need to get this file opened. Please help
    • To post as a guest, your comment is unpublished.
      Gustavo · 3 months ago
      Hi, have this problem when I try yo open a Excel file


      did you find any Solution?



      gustnm@hotmail.com
  • To post as a guest, your comment is unpublished.
    Ian · 7 months ago
    Works great, as long as you are using it for the right problem. If you have worksheet protection to stop people editing formulas, etc. then this is the solution. If you have a password on the workbook for privacy (i.e. can't open workbook without password) then you will need to look elsewhere.
  • To post as a guest, your comment is unpublished.
    Franny · 7 months ago
    Thank you so much! It worked. I am running Windows 10 Pro.
  • To post as a guest, your comment is unpublished.
    Steph · 8 months ago
    THANK YOU SO MUCH!
  • To post as a guest, your comment is unpublished.
    Laddy · 8 months ago
    Worked like a charm on 2016, just as expected. Much appreciated.
  • To post as a guest, your comment is unpublished.
    Paula · 8 months ago
    utilizo la macro y se ejecuta pero
    al final no me sale el aviso con la contraseña; qué puedo hacer? gracias!!
  • To post as a guest, your comment is unpublished.
    Chithra · 1 years ago
    you mentioned, open the sheet which was protected before, what dows that mean ?

    I forgot mt workbook password, and without providing the password, alt + f11 is not working, how to break the password please?
    • To post as a guest, your comment is unpublished.
      Heather · 11 months ago
      Same problem here. Running Excel 2016, but file saved was Excel 2006. I can get into "Microsoft Visual Basic for Applications window.", but on the "Insert" tab all the options (including "Module" are greyed out. Now what can I try???
  • To post as a guest, your comment is unpublished.
    Satish · 1 years ago
    thankyou ... very very usefull
  • To post as a guest, your comment is unpublished.
    teri · 1 years ago
    I get an error: Invalid outside procedure. Please help!
  • To post as a guest, your comment is unpublished.
    vittal · 1 years ago
    THANK YOU VERY MUCH FOR CODE
  • To post as a guest, your comment is unpublished.
    Laura Gonçalves · 1 years ago
    Merci beaucoup ça a très bien fonctionné ! je suis sauvée. Merci encore
  • To post as a guest, your comment is unpublished.
    Horton · 1 years ago
    did not work for 2016, just spins and then the 'not responding'. Frustrating.
    • To post as a guest, your comment is unpublished.
      Godfrey · 1 years ago
      Same thing for me: after pressing F5, no response.
  • To post as a guest, your comment is unpublished.
    Paul · 1 years ago
    Finally. Something on the Internet that actually worked! Saved me a ton of time. Thanks!
  • To post as a guest, your comment is unpublished.
    Michael ONI · 1 years ago
    It works like magic. Many thanks.
  • To post as a guest, your comment is unpublished.
    massy.sarti@gmail.com · 1 years ago
    Dear all..i need to unprotect Workbook structure.. Somebody can help me?
  • To post as a guest, your comment is unpublished.
    Arlene · 1 years ago
    How long does it usually take?
    • To post as a guest, your comment is unpublished.
      Jheng · 1 years ago
      after I press the F5 button, the excel file automatically do not respond
  • To post as a guest, your comment is unpublished.
    Kindness · 1 years ago
    how does it take for code to run?
  • To post as a guest, your comment is unpublished.
    shehbaz · 1 years ago
    Thanks a lot. Its work for me.
  • To post as a guest, your comment is unpublished.
    Maha · 1 years ago
    Hi I need your help desparately. I have lost the password to my excel workbook. Every time a click to open the file, a pop up box is displayed that the file is protected however the password I enter is always incorrect, then a get a message "the password you supplied is not correct. Very that the caps lock kep is off and be sure to use the correct capitalization. I really need to get this file opened. Please help
    • To post as a guest, your comment is unpublished.
      Margot · 1 years ago
      Hi, I'm having the same issue. Were you able to somehow recover the file?
  • To post as a guest, your comment is unpublished.
    MESSI · 1 years ago
    It worked. Thanks for the help
  • To post as a guest, your comment is unpublished.
    Ellesig · 1 years ago
    Thanks so much!
  • To post as a guest, your comment is unpublished.
    guest · 1 years ago
    I'm on Excel for Mac, Mac OS High Sierra. This does not work. It does not cancel the password protection. It also does not provide a working "usable" password. Password is always incorrect. Double checked the code for the usual copy-paste script bug that automatically disables End Sub. Pasted this code into a module all by itself.
    • To post as a guest, your comment is unpublished.
      nirvana · 1 years ago
      Wrong, it works for High Sierra, as I tested it 5 min. ago.
  • To post as a guest, your comment is unpublished.
    flj · 1 years ago
    this is a life saver!
  • To post as a guest, your comment is unpublished.
    Ryan west · 1 years ago
    As soon as I press F5 it goes to not responding and I have to close Excel...
    • To post as a guest, your comment is unpublished.
      Jyel · 1 years ago
      I had the same problem. Have you solved this issue?
  • To post as a guest, your comment is unpublished.
    CL · 1 years ago
    This is a life saver! THANK YOU!
  • To post as a guest, your comment is unpublished.
    Weng · 1 years ago
    Thank you for this ♥
  • To post as a guest, your comment is unpublished.
    dianna · 1 years ago
    when i open the excel password protected file, pop up box password appear. tried hold alt+f11, nothing happens. close the password box, mvb appears but could not add module as it grey out. can someone help me please. thanks
  • To post as a guest, your comment is unpublished.
    Usman · 1 years ago
    Brilliant! Done
  • To post as a guest, your comment is unpublished.
    Madhu Joseph · 2 years ago
    I could not believe it... It worked like a wizard..
  • To post as a guest, your comment is unpublished.
    emmakelly · 2 years ago
    You guys can download this remarkable Excel Password Unlocker software which smoothly recover lost excel file and unlock protection from excel file, word document file and access file. Software easily support all Excel versions upto 2016.
  • To post as a guest, your comment is unpublished.
    Tim · 2 years ago
    Hi, Insert module is greyed out!!! Any help would be appriciated
  • To post as a guest, your comment is unpublished.
    tony · 2 years ago
    sorry doesnt works on 2010 .. ı am getting madddd
  • To post as a guest, your comment is unpublished.
    Bob · 2 years ago
    Worked like a charm.
  • To post as a guest, your comment is unpublished.
    Tochi · 2 years ago
    Please everything is greyed in the MS VB application so the insert and module can't be activated in my own.
  • To post as a guest, your comment is unpublished.
    gmnguru · 2 years ago
    Awesome code! Thanks so much!
  • To post as a guest, your comment is unpublished.
    Noob · 2 years ago
    thank you!!!!!!!!!!!!!!! you saved me lol
  • To post as a guest, your comment is unpublished.
    Elaine · 2 years ago
    The instructions were so easy to follow and worked brilliantly. I had locked myself out of a worksheet for months and couldn't remember the password, thank you
  • To post as a guest, your comment is unpublished.
    ja · 2 years ago
    worked Great!
  • To post as a guest, your comment is unpublished.
    MmM · 2 years ago
    Worked liked a charm! brilliant! cant thank you enough...
  • To post as a guest, your comment is unpublished.
    MC · 2 years ago
    I copied the entire worksheet by clicking on the top left hand corner tab (triangle) and click "copy". Then Insert a new worksheet, paste what I copied in formula mode and then use format painter to retain the formatting. it worked.
  • To post as a guest, your comment is unpublished.
    Elizabeth · 2 years ago
    Thank you so much been working on this spreadsheet for 14 months, then granddaughter decided to type on my computer and added a password ... she is 3 yrs Was very easy to use!
  • To post as a guest, your comment is unpublished.
    AOlivares · 2 years ago
    Hi, I have attempted the instructions 3x and after I press F5, the system is not responding. Is there an alternate option
  • To post as a guest, your comment is unpublished.
    HARRY · 2 years ago
    WHEN F5 KEY PRESS
    THEN ASK TO FILL MACRO NAME
  • To post as a guest, your comment is unpublished.
    Mohammed · 2 years ago
    a lot of thanks, you help me.... very clearly and simple. thank you very much
  • To post as a guest, your comment is unpublished.
    Cape town · 2 years ago
    Thanks support. The world of the IOT is really changing our lives. Thank you!
  • To post as a guest, your comment is unpublished.
    Fernando · 2 years ago
    Awesome!!! Helped a lot :lol:
  • To post as a guest, your comment is unpublished.
    Ryan · 2 years ago
    Awesome! Thank you for helping!