Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rg As Range
Dim c As Range
Set rg = Range("Q10:Q19")
'is the changed cell in the Range to check
If Not Intersect(Target, rg) Is Nothing Then
'Did you enter something in that cell, or just clear it?
If Len(Target) > 0 Then
'Don't trigger the event endlessly
Application.EnableEvents = False
For Each c In rg
'make sure to not clear the cell we just changed
If Intersect(c, Target) Is Nothing Then c.ClearContents
Next c
End If
End If
're-enable the event method
Application.EnableEvents = True
End Sub
1条答案
按热度按时间f1tvaqid1#
您可以使用事件代码:
要进入此事件触发宏,请右键单击工作表选项卡。从右键单击下拉菜单中选择“查看代码”。然后将下面的代码粘贴到打开的窗口中。
字符串