如何使这段代码工作然后表格受到保护?目标单元格不受保护(在属性中未选中)
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("printR")) Is Nothing Then
Application.EnableEvents = False
Cancel = True
Target.ClearContents
Application.EnableEvents = True
End If
End Sub
答案 0 :(得分:1)
您可以尝试在代码中的某处包含此内容
ActiveSheet.Unprotect Password:="123"
然后:
Sheets("sheetName").Protect Password:="123"
希望这有帮助:)