excel vba protect sheet code example
Example: excel vba protect sheet
'Apply worksheet protection to contents, objects and scenarios
Sheets("Sheet1").Protect Password:="myPassword", _
DrawingObjects:=True, _
Contents:=True, _
Scenarios:=True