1091126096 发表于 2013-5-28 19:41
你说的是哪一行?
从这里往下的,我不明白什么意思,麻烦你给我说一下,可以吧
Dim i, j, a, K, N, sr, ARR(1 To 10000, 1 To 7), ARR2(1 To 10000, 1 To 7)
a = 1
For i = 2 To Range("B1").End(xlDown).Row
sr = Range("B" & i)
For j = i To Range("B1").End(xlDown).Row
If Cells(j, 2) = sr Then
ARR(a, 1) = Cells(j, 1)
ARR(a, 2) = Cells(j, 2)
ARR(a, 3) = Cells(j, 3)
ARR(a, 4) = Cells(j, 4)
ARR(a, 5) = Cells(j, 5)
ARR(a, 6) = Cells(j, 6)
ARR(a, 7) = Cells(j, 7)
a = a + 1
End If
Next j
Next i
Range("A2").Resize(a + 1, 7) = ARR
N = 1
L = 0
For i = 1 To 1000
For j = 1 To i
K = ARR(i, 1)
If ARR(j, 1) = K Then
L = L + 1
End If
Next j
If L = 1 Then
ARR2(N, 1) = ARR(i, 1)
ARR2(N, 2) = ARR(i, 2)
ARR2(N, 3) = ARR(i, 3)
ARR2(N, 4) = ARR(i, 4)
ARR2(N, 5) = ARR(i, 5)
ARR2(N, 6) = ARR(i, 6)
ARR2(N, 7) = ARR(i, 7)
N = N + 1
L = 0
End If
L = 0
Next i
Range("A2").Resize(a + 1, 7) = ARR2
End Sub |