Opening an Excel file only to find that it is locked or protected can be frustrating. Especially if you need access to the file urgently, this situation can be challenging to navigate. Fortunately, with the right tools and techniques, you can quickly gain access to your locked Excel file. In this article, we’ll explore some methods you can use to unlock a protected Excel file, so you don’t have to spend hours searching for a solution yourself.
What is a Locked or Protected Excel File?
A locked or protected Excel file is a type of Excel file that requires a password to open or make any changes. The file may be password-protected to prevent unauthorized access or editing, or it may be protected to preserve the integrity of the data.
In general, there are two types of protection that can be applied to an Excel file. One is the password protection that requires a password to open the file or make any changes. The other is the workbook protection that limits certain editing rights to the user, such as formatting or deleting certain cells.
How to Unlock a Password-Protected Excel File
Method 1: Use the Password You Created
The simplest method to unlock a password-protected Excel file is to use the password you created. If you forget the password, you cannot use this method, and you will need to try other approaches to gain entry into the file.
To unlock a password-protected Excel file with the correct password, follow these steps:
- Open the password-protected file in Excel.
- Enter the correct password when prompted.
- The file will unlock, and you can make any necessary changes.
Method 2: Use VBA Code to Crack the Password
Visual Basic for Applications (VBA) code is an advanced solution for unlocking password-protected Excel files. With VBA code, you can create a macro that will crack the password and provide access to the file.
To use VBA code to crack a password-protected Excel file, follow these steps:
- Open Excel and press Alt + F11 to open the VBA editor.
- In the editor, click Insert and select Module.
- Copy and paste the following VBA code into the module:
Sub PasswordBreaker() 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) & i1 & i2 & i3 & i4 & i5 & i6 & Chr(n) If ActiveSheet.ProtectContents = False Then MsgBox "One usable password is " & Chr(i) & Chr(j) & _ Chr(k) & Chr(l) & Chr(m) & i1 & i2 & i3 & i4 & i5 & _ i6 & Chr(n) Exit Sub End If Next: Next: Next: Next: Next: Next Next: Next: Next: Next: Next: Next End Sub
- Press F5 to run the macro.
- The macro will attempt to crack the password and provide a usable password if successful.
- Use the provided password to unlock the Excel file.
Method 3: Use an Online Password Recovery Tool
An online password recovery tool is a convenient option for unlocking password-protected Excel files if you do not have the time or expertise to use VBA code. These online tools use a combination of password algorithms and brute force techniques to crack the password and provide access to the file.
To use an online password recovery tool to unlock a password-protected Excel file, follow these steps:
- Search for an online password recovery tool, such as Lost Password.
- Upload your password-protected Excel file to the website.
- The website will attempt to crack the password and provide a usable password if successful.
- Use the provided password to unlock the Excel file.
How to Unlock a Workbook-Protected Excel File
Method 1: Use the Unprotect Workbook Option
The most straightforward method to unlock a workbook-protected Excel file is to use the built-in Unprotect Workbook option. This option is only available if you know the password to the workbook, but it is a quick and simple solution once you have access to the password.
To unlock a workbook-protected Excel file with the Unprotect Workbook option, follow these steps:
- Open the workbook-protected file in Excel.
- Click on the Review tab at the top of the window.
- Click on the Unprotect Workbook option in the Changes category.
- Enter the password when prompted.
- The workbook will unlock, and you can make any necessary changes.
Method 2: Use the VBA Code to Crack the Password
If you do not know the password to the workbook, you can use VBA code to crack the password and provide access to the file. This method can take some time to complete, depending on the complexity of the password, but it is an effective way to unlock a workbook-protected Excel file.
To unlock a workbook-protected Excel file using VBA code, follow these steps:
- Open Excel and press Alt + F11 to open the VBA editor.
- In the editor, click Insert and select Module.
- Copy and paste the following VBA code into the module:
Sub PasswordBreaker() 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 Dim i7 As Integer, i8 As Integer, i9 As Integer Dim i10 As Integer, i11 As Integer, i12 As Integer Dim i13 As Integer, i14 As Integer, i15 As Integer Dim i16 As Integer, i17 As Integer, i18 As Integer Dim i19 As Integer, i20 As Integer, i21 As Integer Dim i22 As Integer, i23 As Integer, i24 As Integer Dim i25 As Integer, i26 As Integer, i27 As Integer Dim i28 As Integer, i29 As Integer, i30 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 i7 = 65 To 66 For i8 = 65 To 66: For i9 = 65 To 66: For i10 = 65 To 66 For i11 = 65 To 66: For i12 = 65 To 66: For i13 = 65 To 66 For i14 = 65 To 66: For i15 = 65 To 66: For i16 = 65 To 66 For i17 = 65 To 66: For i18 = 65 To 66: For i19 = 65 To 66 For i20 = 65 To 66: For i21 = 65 To 66: For i22 = 65 To 66 For i23 = 65 To 66: For i24 = 65 To 66: For i25 = 65 To 66 For i26 = 65 To 66: For i27 = 65 To 66: For i28 = 65 To 66 For i29 = 65 To 66: For i30 = 32 To 126 ActiveWorkbook.Unprotect Chr(i) & Chr(j) & Chr(k) & _ Chr(l) & Chr(m) & i1 & i2 & i3 & i4 & i5 & i6 & _ Chr(i7) & Chr(i8) & Chr(i9) & Chr(i10) & _ Chr(i11) & Chr(i12) & Chr(i13) & Chr(i14) & _ Chr(i15) & Chr(i16) & Chr(i17) & Chr(i18) & _ Chr(i19) & Chr(i20) & Chr(i21) & Chr(i22) & _ Chr(i23) & Chr(i24) & Chr(i25) & Chr(i26) & _ Chr(i27) & Chr(i28) & Chr(i29) & Chr(i30) If ActiveWorkbook.ProtectStructure = False Then MsgBox "One usable password is " & Chr(i) & Chr(j) & _ Chr(k) & Chr(l) & Chr(m) & i1 & i2 & i3 & i4 & i5 & _ i6 & Chr(i7) & Chr(i8) & Chr(i9) & Chr(i10) & _ Chr(i11) & Chr(i12) & Chr(i13) & Chr(i14) & _ Chr(i15) & Chr(i16) & Chr(i17) & Chr(i18) & _ Chr(i19) & Chr(i20) & Chr(i21) & Chr(i22) & _ Chr(i23) & Chr(i24) & Chr(i25) & Chr(i26) & _ Chr(i27) & Chr(i28) & Chr(i29) & Chr(i30) Exit Sub End If Next: Next: Next: Next: Next: Next Next: Next: Next: Next: Next: Next Next: Next: Next: Next: Next: Next Next: Next: Next: Next: Next: Next Next: Next: Next: Next: Next: Next End Sub
- Press F5 to run the macro.
- The macro will attempt to crack the password and provide a usable password if successful.
- Use the provided password to unlock the workbook-protected Excel file.
FAQ
Q1: Can I unlock an Excel file without a password?
A1: It is not possible to unlock a password-protected Excel file without a password. However, you can use VBA code or an online password recovery tool to crack the password if you have forgotten it.
Q2: Can I remove the password protection from an Excel file?
A2: Yes, you can remove the password protection from an Excel file. To do this, open the file and navigate to the Review tab. Click on the Protect Workbook option and select Protect Structure and Windows option to remove the password protection.