burlinghamla
Board Regular
- Joined
- Nov 11, 2014
- Messages
- 74
I have a button which unlocks my spreadsheet, I would like Row 19 unhidden once this password is entered. Is this possible.
Code:
Sub CommandButton2_Click()
Dim PWord As String
With ActiveSheet
If .ProtectContents Then
PWord = InputBox("Enter Password", "Unprotect Sheet")
If PWord = "" Then Exit Sub
On Error Resume Next
.Unprotect Password:=PWord
If Err <> 0 Then
Err.Clear
MsgBox "Incorrect Password", vbExclamation + vbOKOnly, "Error"
End If
Else
.Protect Password:="test"
End If
End With
End Sub