|
代码如下。。。
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Address = "$T$1" Then
arr = [e13:e112]
brr = [p13:p112]
ReDim crr(1 To UBound(arr), 1 To 2)
For i = 1 To UBound(arr)
If i = 1 Then
If brr(i, 1) = 0 And arr(i, 1) = 0 Then
crr(i, 1) = 1
crr(i, 2) = 0
Else
crr(i, 2) = 1
crr(i, 1) = 0
End If
Else
If brr(i, 1) = 0 And arr(i, 1) = 0 Then
crr(i, 1) = crr(i - 1, 1) + 1
crr(i, 2) = 0
Else
crr(i, 2) = crr(i - 1, 2) + 1
crr(i, 1) = 0
End If
End If
Next
For j = 1 To 2
For i = UBound(crr) To 2 Step -1
If crr(i, j) > crr(i - 1, j) And crr(i - 1, j) <> 0 Then
crr(i - 1, j) = crr(i, j)
End If
Next
Next
[t13].Resize(UBound(crr), 2) = crr
End If
Application.EnableEvents = True
End Sub
|
评分
-
2
查看全部评分
-
|