Sub test()
Dim ws As Worksheet
Set ws = Sheets("Sheet2")
If ws.ProtectContents = True Then
MsgBox "The contents of Sheet2 is protected."
ws.Unprotect
Else
MsgBox "The contents of Sheet2 is unprotected."
End If
Set ws = Nothing
End Sub