Protect Sheet : Worksheet Protection « Excel « VBA / Excel / Access / Word






Protect Sheet

 
Sub ProtectSheet()
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets("Protection")
    ws.Protect "Excel2003", , True, , True
    ws.Range("A1").Value = 42
    Debug.Print ws.ProtectContents
    Debug.Print ws.ProtectDrawingObjects
    Debug.Print ws.ProtectionMode
    Debug.Print ws.ProtectScenarios
End Sub

 








Related examples in the same category

1.Add protection to Worksheet
2.Unprotect worksheet
3.Show Protection Properties
4.remove user
5.Remove user edit range
6.Add user edit range
7.Formulas Protection
8.Protecting Worksheet Assets with the Protect Method