Skip to content


Excel Worksheet Protection Code Breaker

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.

Posted in Computers, Microsoft, Programming, Software.

Tagged with , , , , , , , , , , , , .


8 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. narath says

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

  2. The Monkey in the Tree of Life says

    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 says

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

    Thanks a lot

  4. Derek says

    Excellent work. Code looks so simple.

  5. John Doe says

    Just a notice: link seems to be broken.

  6. Donies says

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

    • m3Rlin says

      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/

  7. Avijit Jana says

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



Some HTML is OK

or, reply to this post via trackback.