This article will show you how to recover an excel password to unlock a workbook or worksheet. Let me preface this article by saying that this will not help you recover lost data, or gain access to protected data that you otherwise wouldn’t have access to. What it will do is allow you to unlock a password protected worksheet in Excel, for instance, if you have forgot your excel password, so that you can edit it as necessary. Simply put, if you don’t already have access to the worksheet, this macro will not help you.
Before we learn how to recover a protected excel sheet password, let’s figure out why people password protect worksheets to begin with. By protecting a worksheet and the contents of locked cells, users can keep themselves or other users from:
- Accidentally (or intentionally) removing formulas, or other contents of locked cells
- Adding or deleting rows and columns
- Changing cell, column or row formats
- Sorting data
- Using AutoFilter or PivotTable reports
- Editing objects or scenarios
Protecting a worksheet will not keep users from
- Editing any unlocked cells in the worksheet
- Viewing all data in the worksheet, regardless of if it is in a locked cell or not
- Hacking excel passwords / Cracking excel passwords. Excel is not ‘secure’.
Being able to unlock a password protected worksheet is useful, when
- You have forgotten the password on your own worksheet (forgotten excel passwords)
- A co-worker, or other user has password protected a worksheet that you now need to edit, and they are not available to unlock the sheet for you
- You have a need to perform an analysis of the data in a password protected worksheet, but are unable to do so due to the locked cells
- You would like to sort/filter the data in a password protected worksheet, or create a PivotTable report from the data
- Need to recover an excel password
Since Microsoft Excel is not a “secure” program, it is very easy to unlock the password of a password protected worksheet. This is because there are several different combinations of passwords that Excel will accept to unlock the worksheet. For example, a worksheet with the password “treehouse”, can also be unlocked with the password “AAAABAABBBB/”. The opposite is also true (i.e. protecting with the password “AAAABAABBBB/” can be unlocked with the password “treehouse”). Go ahead; try locking a worksheet with the password treehouse, and use AAAABAABBBB/ to unlock it.
The macro code below will “unlock” one worksheet at a time, using the method used above. It won’t provide you with the actual password someone typed in, but rather a random sequence of letters or symbols that will work to unlock the worksheet. It should not be used as an excel password hack or for breaking an excel password.
Recover excel password
Step 1 – Open the worksheet in Excel where you have forgotten your excel password. This is so we can try to recover protected excel sheet password with VBA.
Step 2 – Open the VBA Editor (ALT + F11) – see our guide How to open Excel VBA Editor if you are unfamiliar with how to do this.
Step 3 – Insert a new module and use the VBA code below to find your forgot excel password.
Sub PasswordRecovery()
'
'MACROS BY EXCELZOOM.COM
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
Step 4 – Run the VBA code (F5) to recover excel password. You will receive a pop-up like the below to recover the excel sheet password.
It is worth noting that Microsoft is quite clear on its stance that you need to remember or make a note of passwords when protecting a workbook or worksheet and will not offer help in order to recover a lost excel password. See the MS protect a workbook page. So Microsoft cannot help if you have forgotten your excel password or need help recovering a password to open a workbook or worksheet (and probably rightly so!). We notice there is plenty of software available online to help unlock a password protected worksheet in Excel (for all versions of excel) however we like the VBA code noted above as a first option and haven’t tried and tested all third party applications enough to feel comfortable recommending on here.
* Update – Since this code is widely available online I have unrestricted it from our members area to make it available to all. I hope this helps as we all know how frustrating it can be when you are unable to access a worksheet that you need due to a password protected excel forgot password issue at work or at home. This should not be used to crack an excel protected sheet or break into worksheet you should not have access to. It is however, one useful method to unlock an excel password protected excel sheet.
Happy Excelling! And remember, try not to forget that excel worksheet password in the first place if possible! :-)