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.
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:
- Create a New Excel workbook.
- Type some data in Sheet1 in any cell.
- Go to Menu -> Review -> Protect Sheet.
- A Pop-up Window will appear. Enter a Password and Click ok. Double confirm password.
- 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?
Crack Protected Excel Sheet without knowing Password
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.
12345678910111213141516171819202122232425262728Option ExplicitSub UnProtect_Excel_WorkSheet()'Unlock Protect Excel WorksheetDim i1 As Integer, i2 As Integer, i3 As Integer, j1 As Integer, j2 As Integer, j3 As IntegerDim k1 As Integer, k2 As Integer, k3 As Integer, l1 As Integer, l2 As Integer, l3 As IntegerDim a As DoubleOn Error Resume Nexta = 0'Try all Possible Alternate Combination PasswordFor i1 = 65 To 66: For i2 = 65 To 66: For i3 = 65 To 66For j1 = 65 To 66: For j2 = 65 To 66: For j3 = 65 To 66For k1 = 65 To 66: For k2 = 65 To 66: For k3 = 65 To 66For l1 = 65 To 66: For l2 = 65 To 66: For l3 = 32 To 126ThisWorkbook.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 + 1ThisWorkbook.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 RemovedIf ActiveSheet.ProtectContents = False ThenMsgBox "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 SubEnd If'Exit LoopNext: Next: Next: Next: Next: NextNext: Next: Next: Next: Next: NextEnd Sub
Try to enter any data into sheet now. The warning message will not occur now.
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.
Previous Post: Software Downloads From Our App Store – Try Free & Buy
Next Post: Lock a Folder – In Windows – Excel Folder Lock Code
UnLock Protected Excel Sheet – Crack Password to Unprotect