Excel单元格B4,D4和H4,其中任意一个单元格输入内容时,其它两个单元格清...
发布网友
发布时间:2024-09-30 06:16
我来回答
共2个回答
热心网友
时间:2024-10-14 03:18
代码如下。
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Address = "$B$4" And Len(.Text) > 0 Then
[D4] = ""
[H4] = ""
ElseIf .Address = "$D$4" And Len(.Text) > 0 Then
[B4] = ""
[H4] = ""
ElseIf .Address = "$H$4" And Len(.Text) > 0 Then
[D4] = ""
[B4] = ""
End If
End With
End Sub
热心网友
时间:2024-10-14 03:17
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Dim hh, lh As Integer
hh = Target.Row
lh = Target.Column
If hh = 4 And lh = 2 Then
Range("D4").Clear
Range("H4").Clear
End If
If hh = 4 And lh = 4 Then
Range("B4").Clear
Range("H4").Clear
End If
If hh = 4 And lh = 8 Then
Range("B4").Clear
Range("D4").Clear
End If
Application.EnableEvents = True
End Sub
热心网友
时间:2024-10-14 03:16
代码如下。
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Address = "$B$4" And Len(.Text) > 0 Then
[D4] = ""
[H4] = ""
ElseIf .Address = "$D$4" And Len(.Text) > 0 Then
[B4] = ""
[H4] = ""
ElseIf .Address = "$H$4" And Len(.Text) > 0 Then
[D4] = ""
[B4] = ""
End If
End With
End Sub
热心网友
时间:2024-10-14 03:16
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Dim hh, lh As Integer
hh = Target.Row
lh = Target.Column
If hh = 4 And lh = 2 Then
Range("D4").Clear
Range("H4").Clear
End If
If hh = 4 And lh = 4 Then
Range("B4").Clear
Range("H4").Clear
End If
If hh = 4 And lh = 8 Then
Range("B4").Clear
Range("D4").Clear
End If
Application.EnableEvents = True
End Sub