Home > Computers, Microsoft, Programming, Software > Excel Worksheet Protection Code Breaker

Excel Worksheet Protection Code Breaker

March 28th, 2006 Leave a comment Go to comments

Don’t you just hate it when you forget a password? I’ve been in that situation many times simply because I do believe in hard-to-guess passwords while never writing them down (what’s the purpose of the password if you are going to write it down? :-) ).

Here is a VBA (Visual Basic for Applications) macro for Excel that removes worksheet protection that I used almost 2 years ago when I needed to unprotect a file left by the person that held my position before me.

The idea of the macro is very simple: it loops generating passwords and provides you with one that will work. Note, that the one that it provides is almost never the one that was used to actually protect the worksheet but I am not going to explain why that is so. That is not the purpose of this post :-)

I don’t know who wrote it but I know there are people that will one day need it so here you are: download the code here .

This macro should work with Excel 97, Excel 2000, Excel XP / Excel 2002, Excel 2003 and Excel 2007.

  1. May 7th, 2007 at 06:42 | #1

    i want to break code to protect worksheet, workbook,and when open

  2. The Monkey in the Tree of Life
    July 29th, 2009 at 11:45 | #2

    I *urgently* needed to unprotect a sheet, and the fun works just fine. Excellent trick!
    That goes to show how quickly even the notoriously slow VBA, and using a brute force method, as well, is able to break a 40 bit hash.

  3. thomas
    October 5th, 2009 at 07:11 | #3

    This code is really superb and working fine.;…..

    Thanks a lot

  4. Derek
    December 4th, 2009 at 07:49 | #4

    Excellent work. Code looks so simple.

  5. Donies
    February 8th, 2010 at 08:39 | #5

    i have a macintosh .. where am i suppose to put this code.. ??

    • February 8th, 2010 at 14:49 | #6

      Unfortunately Microsoft killed VBA for Office on the Microsoft platform back in 2007. At the time the Microsoft Mac Business Unit (Mac BU) announced it will be discontinuing support of Visual Basic scripting in the next version of Office for Mac, but said it is working hard to increase support for standard Mac scripting methods such as AppleScript and Automator.

      Source: http://www.macnn.com/articles/06/08/07/ms.kills.virtualpc/

  6. Avijit Jana
    March 4th, 2010 at 10:24 | #7

    Thanks.
    It solve my purpose. If possible can you explain me the Coding.

  7. AQ
    May 27th, 2010 at 17:32 | #8

    how do I install it

    • June 3rd, 2010 at 04:36 | #9

      The easiest way is to open Visual Basic for Application in Excel (the shortcut is Alt + F11) and the editor will open. On the left you will see your workbook and its sheets. Double click on any sheet and the code editor will open. Just past the code into the editor and press F5 to run the code. After a few minutes (usually less) you will get a popup with a password that will work.

  8. fadzwan
    July 23rd, 2010 at 04:57 | #10

    please help me, send the code..

  9. NANCY
    July 29th, 2010 at 08:30 | #12

    Fantastic! Thanks you save me a lot of time :-)