Sub test()
Dim Arr, Brr$(), st$, r&, c%, k%, m&, n%
[k2:n6666] = ""
Arr = [a1].CurrentRegion.Resize(, 10)
ReDim Brr(1 To UBound(Arr), 1 To 4)
For r = 3 To UBound(Arr)
k = 0
For c = 2 To 8 Step 2
k = k + IIf(Arr(r, c) = Arr(r, c + 2), 1, 0)
Next
If k > 0 Then
m = m + 1
n = 0
For c = 2 To 8 Step 2
If Arr(r, c) = Arr(r, c + 2) Then n = n + 1: st = Arr(r, c)
Next
If Arr(r, 2) = Arr(r, 4) And Arr(r, 8) = Arr(r, 10) And Arr(r, 4) <> Arr(r, 6) Then n = n - 1
Brr(m, n) = st
End If
Next
[k2].Resize(m, 4) = Brr
End Sub '第3次更改了,不知如何,没招了
|