How do I protect or lock an Excel worksheet? How do I protect / lock an Excel worksheet, but still have some cells or ranges unprotected or unlocked?
To protect a worksheet, use this… ActiveSheet.Protect password:=”testpass”, DrawingObjects:=False, Contents:=True, Scenarios:=True To unprotect a worksheet, use this ActiveSheet.Unprotect password:=”testpass” To protect a worksheet, but still have some cells or ranges unprotected , first unlock the cells or range you don’t want to protect, then protect the worksheet. the next 2 lines protect the worksheet except the range A10 to D10. ActiveSheet.Range(“A10:D10”).Locked = False ActiveSheet.