Excel VBA保护工作表

  


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

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

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

posted @ 2015-12-24 10:37  billqian  阅读(3658)  评论(0编辑  收藏  举报