Skip to main content

How to recover lost worksheet protection password in Excel?

Author: Xiaoyang Last Modified: 2019-09-20

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?

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


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!
Comments (99)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
What is the Macro name?
This comment was minimized by the moderator on the site
Even using this code below, I continue to receive this message: (When I running that code on Excel 365, I got this message error:
Runtime '1004'
The password you supplied is not correct. Verify that the CAPS LOCK key is off and be sure to use the correct capitalization.
Please if you can help me on this.
thank you very much)
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
This comment was minimized by the moderator on the site
Hello, Jose,
If the VBA code can't work well in Office 365, maybe the following article can help you, there are two methods in that article, please check it:
https://www.extendoffice.com/documents/excel/7179-excel-unprotect-all-sheets-without-password.html
Thank you!
This comment was minimized by the moderator on the site
When I running that code on Excel 365, I got this message error:
Run-time '1004'
The password you supplied is not correct. Verify that the CAPS LOCK key is off and be sure to use the correct capitalization.
Please if can help me on this.
thank you very much
This comment was minimized by the moderator on the site
The tip to recover my password says to open the Excel document. Without the password I cant open it, so how does this work?
This comment was minimized by the moderator on the site
Il existe de nombreux programmes pour récupérer le mot de passe des fichiers Excel. J'utilise Manyprog Excel Password Recovery. C'est rapide et facile à utiliser. https://fr.manyprog.com/excel-password-recovery.php
This comment was minimized by the moderator on the site
Hi. I've got Microsoft 365 . Does it work too ?I tried, but for now couldn't open my xlsx files..
This comment was minimized by the moderator on the site
Thank you! After saving it as an Excel 91-2003 (.xls) doc, I was able to use this to unlock all the worksheets within the workbook. Literally saved me so much time.
This comment was minimized by the moderator on the site
This does not appear to work. It only generates passwords with As, Bs and something else at the end. What am I missing?
This comment was minimized by the moderator on the site
This algorithm doesn't work. Only generates PWs with As, Bs and something different at the end. What am I missing?
This comment was minimized by the moderator on the site
Hay muchos programas para recuperar la contraseña de los archivos de Excel. Estoy usando Manyprog Excel Password Recovery. Es rápido y fácil de usar. https://es.manyprog.com/excel-password-recovery.php
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations