Sub ProtectSheet()
On Error Resume Next
Workbooks(ThisWorkbook.Name).Activate
ActiveSheet.Protect ("PassWord"), DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows _
:=True, AllowSorting:=True, AllowFiltering:=True, AllowUsingPivotTables _
:=True
ActiveSheet.EnableSelection = xlNoRestrictions
End Sub
‘*******************************************************************************
Sub UnProtectSheet()
On Error Resume Next
Workbooks(ThisWorkbook.Name).Activate
ActiveSheet.Unprotect ("PassWord ")
End Sub