|
- Sub Test()
- Dim Dic As Object, Lj, LastR&, i&, j&, k&, St$, Br, FirstR&
- FirstR = 11
- Br = Array(, "w", "c", "d", "aa")
- Application.Intersect(Columns("A:Q"), ActiveSheet.UsedRange).Offset(FirstR - 1).ClearContents
- Set Dic = CreateObject("Scripting.Dictionary")
- With Worksheets("匹配")
- LastR = .Cells(Rows.Count, "P").End(xlUp).Row
- ReDim Lj(FirstR To LastR + FirstR) 'FO的列号
- For i = 2 To LastR
- St = .Cells(i, "P")
- If Not Dic.Exists(St) Then
- j = Dic.Count + FirstR: Dic(St) = j: Lj(j) = 5
- For k = 1 To UBound(Br)
- Cells(j, k) = .Cells(i, Br(k))
- Next
- For k = 11 To 16: Cells(j, k) = .Cells(i, k + 5): Next
- Cells(j, 17) = .Cells(i, "V") & .Cells(i, "Y") & .Cells(i, "X")
- Else
- j = Dic(St): Lj(j) = Lj(j) + 2
- End If
- Cells(j, Lj(j)) = .Cells(i, "F")
- Cells(j, Lj(j) + 1) = .Cells(i, "O")
- Next
- End With
- Set Dic = Nothing
- End Sub
复制代码 |
|