|
- Sub test()
- Dim r%, i%
- Dim arr, brr
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- With Worksheets("1")
- r = .Columns(1).Find(what:="*", LookIn:=xlValues, lookat:=xlWhole, searchorder:=xlByRows, searchdirection:=xlPrevious).Row
- If r > 2 Then
- arr = .Range("a3:m" & r)
- For i = 1 To UBound(arr)
- If Not d.exists(arr(i, 10)) Then
- Set d(arr(i, 10)) = .Cells(2 + i, 1).Resize(1, 8)
- Else
- Set d(arr(i, 10)) = Union(d(arr(i, 10)), .Cells(2 + i, 1).Resize(1, 8))
- End If
- Next
- End If
- End With
- For Each aa In d.keys
- With Worksheets(aa & "课登记表")
- r = .Columns(1).Find(what:="*", LookIn:=xlValues, lookat:=xlWhole, searchorder:=xlByRows, searchdirection:=xlPrevious).Row
- d(aa).Copy .Cells(r + 1, 1)
- End With
- Next
- End Sub
复制代码 |
|