|
楼主 |
发表于 2018-8-10 17:57
|
显示全部楼层
辛苦了,谢谢。不过这段代码表达的是什么意思呢?
If Len(arr(i, 6)) = 0 And Len(arr(i, 7)) Then
brr(m, 9) = arr(i, 9)
Else
brr(m, 9) = arr(i, 10)
End If
我根据我自己的理解修改了一下代码,效果还可以。Private Sub Worksheet_Change(ByVal T As Range)
If T.Row = 2 And T.Column = 3 Then
arr = Sheet7.[a1].CurrentRegion
ReDim brr(1 To UBound(arr), 1 To 10)
For i = 3 To UBound(arr)
If arr(i, 8) = T.Value Or arr(i, 9) = T.Value Then
m = m + 1
brr(m, 1) = n
For j = 2 To 6
brr(m, j) = arr(i, j - 1)
Next
brr(m, 7) = arr(i, 6)
brr(m, 8) = arr(i, 7)
brr(m, 9) = arr(i, 10)
brr(m, 10) = arr(i, 12)
End If
Next
If m Then
[a1].CurrentRegion.Offset(3).ClearContents
[a4].Resize(m, 10) = brr
End If
End If
End Sub
其中:If m Then
[a1].CurrentRegion.Offset(3).ClearContents
[a4].Resize(m, 10) = brr
End If
这段代码也不是很明白,求解答
|
|