Anda di halaman 1dari 5

Explore (/tag/type-id/) Create (/about/submit.

jsp) let's
Contestsmake
Login (/contest/) | Community
(/account/login) (/community/)
Sign Up (/account/gopro?sourcea=header)

(/)
share what you make >
(/)
(/editInstructable/)

VBA Code To Unlock A Locked Excel Sheet by syfrog (/member/syfrog/)

Download (/id/VBA-Code-To-Unlock-A-Locked-Excel-Sheet/?download=pdf)

(/id/VBA-Code-To-Unlock-A-Locked-Excel-Sheet/) 4 Steps

Collection I Made it! Favorite Share

About This Instructable

License:
39,909 views
12 favorites

syfrog
(/member/syfrog/)
Follow 25

(/member/syfrog/)
Bio: I work in industrial automation and
spend any free time making.

More by syfrog

(/id/PVC-End-Table)

(http://cdn.instructables.com/FCR/0BNA/HQ731FJC/FCR0BNAHQ731FJC.LARGE.jpg)

(/id/R2D2-Throw-Toy-Hack)

(/id/Thrift-Store-Clock-
Upcycle)

(http://cdn.instructables.com/F1P/FJJ3/HQ731FJ9/F1PFJJ3HQ731FJ9.LARGE.jpg)
Tags:
excel (/tag/type-id/category-technology/keyword-
excel/)

If you have ever forgotten a password for one of your excel worksheets you lost (/tag/type-id/category-technology/keyword-lost/)

know how frustrating that can be. password, (/tag/type-id/category-technology/keyword-


password,/)
The code used in this instruction is one of the simplest I've found. It will generate unlock (/tag/type-id/category-technology/keyword-
a usable code that will unlock your protected sheet. unlock/)

workbook, (/tag/type-id/category-technology/keyword-
I can't take credit for the code as I merely found it in a moment of need (and I workbook,/)
can not find where the site is anymore)... sooo I wont be much help if it doesn't
excel, (/tag/type-id/category-technology/keyword-
work for you but I've had success with it and thought I'd share.
excel,/)

VBA (/tag/type-id/category-technology/keyword-vba/)

code (/tag/type-id/category-technology/keyword-
code/)

Step 1: Open VBA


Related

Create Objective Type


Questions in Excel
(/id/Create-Objective-
LED Scolling Dot Matrix
Font & Graphics Generator
5x8 5x7 8x8 (/id/LED-
Scolling-Dot-Matrix-Font-
Graphics-Generator-/)
Hacking Microsoft Office
Excel to read live RSS
stock news feeds
(/id/Hacking-Microsoft-
Office-Excel-to-read-live-
Using Excel As A
(http://cdn.instructables.com/FSU/6YHV/HQ731FJA/FSU6YHVHQ731FJA.LARGE.jpg)
Dashboard (/id/Using-
Excel-As-A-Dashboard/)
by syfrog (/member/syfrog/)

Open the worksheet you forget your password to. "MadLib" Robot using
Excel (/id/MadLib-Robot-
Use Alt+F11 to enter the macro editor. using-Excel/)
by Bitsi (/member/Bitsi/)
Once in VBA double click the sheet you need to unlock from the menu listing on
the left.
See More (/tag/type-id/?q=)
This will open the general declarations page for the sheet.

Step 2: Cut And Paste The Code Breaker

(http://cdn.instructables.com/FUX/PDFS/HQAWYGWO/FUXPDFSHQAWYGWO.LARGE.jpg)

Insert the code below in the general declarations page you have opened.

You should not have to change anything , sheet name etc... Just cut and paste.
_______________________

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 "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 3: Run The Macro

(http://cdn.instructables.com/FVS/QXRE/HQAWYGWR/FVSQXREHQAWYGWR.LARGE.jpg)

Once the code is added run the Macro by selecting Run from the menu tab bar
at the top of the VBA editor screen or simple press F5

Step 4: Use The Generated Code

(http://cdn.instructables.com/FIG/JXGN/HQAWYGWM/FIGJXGNHQAWYGWM.LARGE.jpg)
The macro will return you to the worksheet you want to unprotect. An alert style
box will(http://cdn.instructables.com/FTO/QOB5/HQAWYGWU/FTOQOB5HQAWYGWU.LARGE.jpg)
appear with a usable code.

In the Review menu tab click Unprotect sheet.


Enter the generated code as the password and your done. Your sheet should be
unlocked!

You should use this power wisely and responsibly only to unlock your own
worksheets.

(http://cdn.instructables.com/FR0/ANAC/HQAWYGWX/FR0ANACHQAWYGWX.LARGE.jpg)

We have a be nice comment policy.


I Made it! Add Images Make Comment
Please be positive and constructive.

About Us Find Us
Who We Are (/about/) Facebook (http://www.facebook.com/instructables)
Advertise (/advertise/) Youtube (http://www.youtube.com/user/instructablestv)
Contact (/about/contact.jsp) Twitter (http://www.twitter.com/instructables)
Jobs (/community/Positions-available-at-Instructables/)
Pinterest (http://www.pinterest.com/instructables)
Help (/id/how-to-write-a-great-instructable/)
Google+ (https://plus.google.com/+instructables)
Tumblr (http://instructables.tumblr.com)
Resources Mobile
For Teachers (/teachers/) Download our new apps for iOS,
Artists in Residence Join
(/group/air/) Android and Windows 8!
our newsletter: enter email Join! English
Gift Pro Account (/account/give?sourcea=footer)
Forums (/community/) Android
Answers (/tag/type-question/?sort=RECENT)
Terms of Service (https://play.google.com/store/apps/details?
(http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=21959721) |
Sitemap (/sitemap/)
Privacy Statement id=com.adsk.instructables)
(http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=21292079) |
Legal Notices & Trademarks (http://usa.autodesk.com/legal-notices-trademarks/) | Mobile Site (http://m.instructables.com)
iOS
(http://usa.autodesk.com/adsk/servlet/pc/index?id=20781545&siteID=123112)
(https://itunes.apple.com/app/instructables/id586765571)
2014 Autodesk, Inc.
Windows
(http://apps.microsoft.com/windows/en-
us/app/7afc8194-c771-441a-9590-
54250d6a8300)
Go Pro Today (/account/gopro?sourcea=footer)

We're Hiring! (/community/Positions-available-at-Instructables/)

Anda mungkin juga menyukai