|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("2018年")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a7:h" & r)
- For i = 1 To UBound(arr)
- If Not d.exists(arr(i, 2)) Then
- Set d(arr(i, 2)) = CreateObject("scripting.dictionary")
- End If
- d(arr(i, 2))(i) = ""
- Next
- r = .Cells(.Rows.Count, 14).End(xlUp).Row
- .Range("o7:ax" & r).ClearContents
- brr = .Range("m7:ax" & r)
- For i = 1 To UBound(brr)
- If d.exists(brr(i, 2)) Then
- n = 3
- For Each bb In d(brr(i, 2)).keys
- For j = 1 To 6
- brr(i, n + j - 1) = arr(bb, j + 2)
- Next
- n = n + 6
- Next
- End If
- Next
- .Range("m7:ax" & r) = brr
- End With
- End Sub
复制代码 |
|