Mega Code Archive

 
Categories / VisualBasic Script / Excel
 

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