Forum Discussion
p-m-med759
Aug 26, 2021Copper Contributor
Excel password protected - how to unprotect
When I open excel - it tells me that it's password protected though I have tried using online suggestions to unprotect this. It says" >>> Is reserved by... enter password for write access, or open r...
HenryPark
Sep 03, 2024Copper Contributor
Another possible way to unprotect a password protected Excel worksheet is by using the VBA Macro.
VBA is a programming language developed by Microsoft that is built into most Microsoft Office applications, including Excel. VBA allows users to automate tasks by writing custom scripts, often referred to as macros. In Excel, VBA macros can automate repetitive tasks, manipulate data, and even interact with other applications. You can write macros to perform various tasks, such as unprotecting a worksheet, formatting cells, or even generating reports.
You can use the following VBA code to unlock a Excel worksheet when you forgot Excel password:
Sub PasswordBreaker()
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
ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & _
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _
Chr(i4) & Chr(i5) & Chr(i6)
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)
Exit Sub
End If
Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next
End Sub