Sub Macro1()
sheet1.Protect AllowFiltering:=true
sheet1.unProtect
End Sub
保护时如果选择了最后两项的话,这两句会失效,使用以下四句可能解决
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFiltering:=True, AllowUsingPivotTables:=True
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
False, AllowFiltering:=True, AllowUsingPivotTables:=True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:= _
False, AllowFiltering:=True, AllowUsingPivotTables:=True
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
True, AllowFiltering:=True, AllowUsingPivotTables:=True
ActiveSheet.Unprotect
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。