Monday 11 February 2008

How To: Unlock Protected Excel Worksheet with a Password - Without the Password!

I went to modify a worksheet today that's used for tracking a few things, but found that I couldn't change the period of the report. The group who was responsible for posting these was behind in doing so and I really wanted to fill out the report before I forgot what I wanted to put in it.
This meant I had to find a way to unprotect the sheet without a password.
Easier done than said!

I opened the workbook, opened up the VB Editor and typed in the following code:
Sub NoProtection()
With ActiveWorkbook
ActiveSheet.Protect Password:="abc"

ActiveSheet.Unprotect Password:="abc"
End With
End Sub

That's it! The previous password is overwritten, then the sheet is unlocked.

...and that's why you never rely on Excel worksheet protection to protect anything.

Disclaimer: This was Excel 2003... Haven't tested if this still works with 2007

No comments: