|
本帖最后由 ykcbf1100 于 2024-8-22 12:30 编辑
参与一下。。。- Sub ykcbf() '//2024.8.22
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("人员名册")
- r = .Cells(Rows.Count, 5).End(3).Row
- arr = .[a1].Resize(r, 11)
- Set Rng = .[a3].Resize(, 11)
- End With
- For i = 5 To UBound(arr)
- s = arr(i, 6)
- If s <> Empty Then
- If Not d.exists(s) Then Set d(s) = CreateObject("Scripting.Dictionary")
- d(s)(i) = i
- End If
- Next
- With Sheets("成表")
- .UsedRange.ClearContents
- .Columns(3).NumberFormatLocal = "@"
- For Each k In d.keys
- m = m + 1
- Rng.Copy .Cells(m, 1)
- For Each kk In d(k).keys
- m = m + 1
- For j = 1 To UBound(arr, 2)
- .Cells(m, j) = arr(kk, j)
- Next
- Next
- m = m + 1
- Next
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|