|
昨天晚上说的那两个地方你没改。代码部分地方我有关事件响应,你卡着的地方,执行了关闭响应,卡死在中间,没执行恢复响应。我直接发代码吧。你先把上面这个tt执行一下,然后应该就能恢复事件响应了。
Sub tt()
Application.EnableEvents = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge = 1 Then
If Not Intersect(Target, Range("a:a")) Is Nothing Then
If Len(Target.Value) = 8 Then
Application.EnableEvents = False
Cells(Target.Row, "B").Value = Mid(Target.Value, 3, Len(Target.Value) - 2)
Cells(Target.Row, "C").Value = Left(Target.Value, 2)
Application.EnableEvents = True
Cells(Target.Row, "K").Value = Cells(Target.Row, "B").Value
Else
Set Rng = Union(Range(Cells(Target.Row, "B").Address, Cells(Target.Row, "C").Address), Range(Cells(Target.Row, "K").Address, Cells(Target.Row, "N").Address))
Application.EnableEvents = False
Rng.ClearContents
Application.EnableEvents = True
Exit Sub
End If
ElseIf Not Intersect(Target, Range("K:K")) Is Nothing Then
If Target.Value = "" Then
Cells(Target.Row, "L").Value = ""
Else
Cells(Target.Row, "L").NumberFormat = "yyyy/m/d"
Cells(Target.Row, "L").Value = Date
End If
ElseIf Not Intersect(Target, Range("L:L")) Is Nothing Then
myId = Cells(Target.Row, "K")
myTime = 0
For i = 2 To Target.Row
If Cells(i, "K").Value = myId Then
myTime = myTime + 1
End If
Next i
If myTime Mod 2 Then
Cells(Target.Row, "M").NumberFormat = "HH:MM:SS"
Cells(Target.Row, "M").Value = Now
Else
Cells(Target.Row, "N").NumberFormat = "HH:MM:SS"
Cells(Target.Row, "N").Value = Now
End If
End If
End If
End Sub |
评分
-
1
查看全部评分
-
|