Excel VBA保护工作表

  


'设定可编辑区域
ActiveSheet.Protection.AllowEditRanges.Add Title:="区域1", Range:=Range("E5:H12")

'保护工作表,但允许上面设定的区域可以编辑
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="123"

'撤销工作表保护
'ActiveSheet.Unprotect

原文地址:https://www.cnblogs.com/billqian/p/protect-excel-vba.html