|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- 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
复制代码 |
|