Unprotect Excel Sheet – Without Knowing Password

Get VBA Macro code in this page, that will help you to generate an alternate password to un-protect Excel sheet.

This will be helpful, if you have forgotten your password. The generated password can be supplied to unlock protected Excel sheet & can be used with Sheet.Unprotect Method.

Note: This method does not allow you to recover or crack a password protect Excel Workbook. Do not use it to on Excel Files that you are not authorized to open.


How To Crack Protected Excel Sheet?

Open the Excel workbook. The execute this code as explained below. This would crack protected Excel sheet.

In the same sheet, press Alt + F11 to get the VB Editor. Copy paste the below code in the VBE. Press F5 to execute the code. This code will generate alternate password combination to unlock the sheet. Once it succeeds, the loop will terminate and will provide you an alternate password.

Note: This code is provided so that it help if you lost a password for your protected Excel sheet. but not for cracking into others unauthorized documents. Also, we have other article links below that would guide you to a more secure way of protecting your Excel document from intruders.

Option Explicit
Sub UnProtect_Excel_WorkSheet()
    'Unlock Protect Excel Worksheet
    Dim i1 As Integer, i2 As Integer, i3 As Integer, j1 As Integer, j2 As Integer, j3 As Integer
    Dim k1 As Integer, k2 As Integer, k3 As Integer, l1 As Integer, l2 As Integer, l3 As Integer
    Dim a As Double
    On Error Resume Next
    a = 0
    'Try all Possible Alternate Combination Password
    For i1 = 65 To 66: For i2 = 65 To 66: For i3 = 65 To 66
    For j1 = 65 To 66: For j2 = 65 To 66: For j3 = 65 To 66
    For k1 = 65 To 66: For k2 = 65 To 66: For k3 = 65 To 66
    For l1 = 65 To 66: For l2 = 65 To 66: For l3 = 32 To 126
        ThisWorkbook.Sheets(1).Unprotect Chr(i1) & Chr(i2) & Chr(i3) & Chr(j1) & Chr(j2) & Chr(j3) & Chr(k1) & Chr(k2) & Chr(k3) & Chr(l1) & Chr(l2) & Chr(l3)
        a = a + 1
        ThisWorkbook.Sheets(2).Cells(a, 1) = Chr(i1) & Chr(i2) & Chr(i3) & Chr(j1) & Chr(j2) & Chr(j3) & Chr(k1) & Chr(k2) & Chr(k3) & Chr(l1) & Chr(l2) & Chr(l3)
        'Check if the Protection is Removed
        If ActiveSheet.ProtectContents = False Then
            MsgBox "One usable password is " & Chr(i1) & Chr(i2) & Chr(i3) & Chr(j1) & Chr(j2) & Chr(j3) & Chr(k1) & Chr(k2) & Chr(k3) & Chr(l1) & Chr(l2) & Chr(l3)
            Exit Sub
        End If
        'Exit Loop
    Next: Next: Next: Next: Next: Next
    Next: Next: Next: Next: Next: Next
End Sub

Try to enter any data into sheet now. The warning message will not occur now.

Unlock Protected Excel Sheet Without Password

This code is not something that I invented. It is all over the Internet, but still many People use this method of protecting a worksheet with a password. You can use this Worksheet Protection password, only to prevent accidental updates happening to an Excel Workbook.

If you want to completely stop un-authorized access to a Excel File, then use complete encryption provided by Microsoft as discussed in this page.

The Code in this page is a very good learning to know how exact password is not used to lock your sheet. Only hash table is used. Google about it to understand more on this.

How To Protect Excel Sheet with Password – Lock Editing?

To test whether this code works or not lets create a Excel & protect it with a password as in following steps:

  1. Create a New Excel workbook.
  2. Type some data in Sheet1 in any cell.
  3. Go to Menu -> Review -> Protect Sheet.
  4. A Pop-up Window will appear. Enter a Password and Click ok. Double confirm password.
  5. Now, If you type any data in Sheet, Excel will give you a warning message saying that the Sheet is protected from Editing.

That’s it. We have protected the Excel Sheet & locked it from editing. Assume, You forgot the password. What do you do then?

Unprotect Excel Sheet – Better Encrypt Workbook

Microsoft has provided an option to lock and unlock worksheets from editing as an additional flexibility for VBA developers. So, it is advised not to use this code to exploit or crack or hack password protected Excel Sheet data from other users, for which you are not authorized.

This method explained here is to educate that there is an easy way to unprotect locked Excel sheet just with few lines of Excel Macro coding.

If you really want to keep your Excel files so safe, then use the method to password protect whole Excel file, explained in another article in this site.

Leave a Reply