尝试编辑受保护的单元时自定义消息

时间:2016-11-17 10:35:10

标签: excel-vba vba excel

当用户点击受保护的单元格时,我们可以自定义从Microsoft获得的消息吗?

我有下面的代码,它不起作用,因为它应该。我想在用户单击受保护的单元格或尝试在其上键入时自定义消息。

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Locked = True Then
    Application.Undo
    MsgBox "You must use the Data Entry Form to enter data in this cell"
End If
Application.EnableEvents = True
End Sub

我仍然会收到enter image description here下面的默认消息

0 个答案:

没有答案