Tip: Other languages are Google-Translated. You can visit the English version of this link.
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


arrow blue right bubble 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.

doc-recover-password1

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/.


Related articles:

How to protect multiple worksheets at once in Excel?

How to unprotect multiple worksheets at once in Excel?


Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
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.
    Chithra · 2 months 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 · 1 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 · 2 months ago
    thankyou ... very very usefull
  • To post as a guest, your comment is unpublished.
    teri · 3 months ago
    I get an error: Invalid outside procedure. Please help!
  • To post as a guest, your comment is unpublished.
    vittal · 3 months ago
    THANK YOU VERY MUCH FOR CODE
  • To post as a guest, your comment is unpublished.
    Laura Gonçalves · 4 months ago
    Merci beaucoup ça a très bien fonctionné ! je suis sauvée. Merci encore