0% found this document useful (0 votes)
6 views

unlocking protected sheet

Uploaded by

Niro jay Jimeno
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

unlocking protected sheet

Uploaded by

Niro jay Jimeno
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Using VBA Code in Excel 2010 and Earlier

1.

1
Open the workbook that has a protected sheet in Excel. You can
usually do this by double-clicking the file's name on your computer.
Excel files usually end with the file extension . x l s or . x l s x .
 Use this method if you have already tried unlocking a
sheet but found that it's password-protected (and you don't
know the password).
 This method will not work in Excel 2013 or later.
2.

2
Re-save the file in the x l s format. If the file you're working on has
the ".xlsx" extension (common if it was created or edited in newer
versions of Excel), you'll only be able to use this method if you first
convert it to the Excel 97-2003 (.xls) format. Here's how to do this:
 Click the File menu at the top-right corner.
 Click Save As.
 Go to the folder in which you want to save the file.
 Select Excel 97-2003 (.xls) from the "Save as type" or "File
Format" menu.
 Click Save.
Follow the on-screen prompts to make any necessary
conversions.
3.

3
Press Alt + F11 to open the Visual Basic Editor.
4.

4
Right-click the workbook's file name in the "Project -
VBAProject" panel. It's at the top of the left panel. Make sure you
right-click the option that contains the file's name (ends with ".xls"),
which should be at the top. A menu will expand.
5.

5
Click Insert on the menu. Another menu will expand.
6.

6
Click Module . This inserts a new module in which you'll paste some
code.

7. 7
Copy the code. Highlight the code that follows this text, then
press Ctrl + C (PC) or ⌘ Command + C to copy it:[5]
Sub PasswordBreaker()
'Breaks worksheet password protection.
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 "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
8.

8
Right-click the new module and select Paste . The copied code
now appears in the module window.
9.
9
Press F5 to run the code. Excel will now run the code, which can
take several minutes. Once the code is finished running, a new
password will appear on a pop-up window. [6]
 The new password will be a random number of "As" rather
than the original password.
10.

10
Click OK on the Password pop-up. A new password will appear but
you won't need to write it down. Clicking OK will remove sheet
protection automatically.[7]
 If you had to convert the file to an earlier format, you can
now save the workbook again as an .xlsx file.
Using VBA Code in Excel 2010 and Earlier
1.

1
Open the workbook that has a protected sheet in Excel. You can
usually do this by double-clicking the file's name on your computer. Excel files
usually end with the file extension . x l s or . x l s x .

 Use this method if you have already tried unlocking a sheet but
found that it's password-protected (and you don't know the
password).
 This method will not work in Excel 2013 or later.
2.
2
Re-save the file in the x l s format. If the file you're working on has the
".xlsx" extension (common if it was created or edited in newer versions of
Excel), you'll only be able to use this method if you first convert it to the
Excel 97-2003 (.xls) format. Here's how to do this:

 Click the File menu at the top-right corner.


 Click Save As.
 Go to the folder in which you want to save the file.
 Select Excel 97-2003 (.xls) from the "Save as type" or "File
Format" menu.
 Click Save.
Follow the on-screen prompts to make any necessary conversions.
3.

3
Press Alt + F11 to open the Visual Basic Editor.

4.

4
Right-click the workbook's file name in the "Project - VBAProject"
panel. It's at the top of the left panel. Make sure you right-click the option
that contains the file's name (ends with ".xls"), which should be at the top. A
menu will expand.
5.
5
Click Insert on the menu. Another menu will expand.
6.

6
Click Module . This inserts a new module in which you'll paste some code.

7. 7
Copy the code. Highlight the code that follows this text, then
press Ctrl + C (PC) or ⌘ Command + C to copy it:[5]

Sub PasswordBreaker()
'Breaks worksheet password protection.
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 "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
8.

8
Right-click the new module and select Paste . The copied code now
appears in the module window.
9.

9
Press F5 to run the code. Excel will now run the code, which can take

several minutes. Once the code is finished running, a new password will
appear on a pop-up window.[6]

 The new password will be a random number of "As" rather than the
original password.
10.
10
Click OK on the Password pop-up. A new password will appear but
you won't need to write it down. Clicking OK will remove sheet
protection automatically.[7]
 If you had to convert the file to an earlier format, you can
now save the workbook again as an .xlsx file.

You might also like