在表格的SheetChange事件里用VBA加個(gè)保護(hù):
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Application.EnableEvents = False
If Target.HasFormula Then
MsgBox Sh.Name & ! & Target.Address(0, 0) & 是受保護(hù)的公式區(qū)域,不能改~
Application.Undo
End If
Application.EnableEvents = True
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Application.EnableEvents = False
If Target.HasFormula Then
MsgBox Sh.Name & ! & Target.Address(0, 0) & 是受保護(hù)的公式區(qū)域,不能改~
Application.Undo
End If
Application.EnableEvents = True
End Sub