|
- Range("G2").Select
- Application.CutCopyMode = False
- Range("A1:G40").Sort Key1:=Range("G2"), Order1:=xlAscending, Key2:=Range( _
- "B2"), Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase _
- :=False, Orientation:=xlTopToBottom, SortMethod:=xlPinYin, DataOption1:= _
- xlSortNormal, DataOption2:=xlSortNormal
- Range("C2").Select
- Selection.Sort Key1:=Range("C2"), Order1:=xlAscending, Header:=xlGuess, _
- OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _
- :=xlPinYin, DataOption1:=xlSortNormal
- Range("B2").Select
- 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
复制代码 你说的是哪一行? |
|