Wrong password - Why?

J

John Curio

Hi

Why does this code give me the wrong password?
The msgbox says "105" instead of "124".
And the crazy thing is, that Excel unprotect the password with 105.
Can somebody explain me that phenomena?

Sub Passwort()
Dim i As Integer
ActiveSheet.Protect Password:=124
On Error Resume Next
For i = 1 To 110
ActiveSheet.Unprotect Password:=i
If ActiveSheet.ProtectContents = False Then
MsgBox "The Password is: " & i
Exit For
End If
Next i
End Sub

Thank's
John
 
Top