|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
请参考:- Dim sh As Worksheet, arr, s$, i&, k, t, lc&
- arr = [a1].CurrentRegion
- lc = UBound(arr, 2)
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- With CreateObject("scripting.dictionary")
- For i = 6 To UBound(arr) - 1
- s = arr(i, 3)
- If Not .Exists(s) Then .Add s, Cells(i, 1).Resize(1, lc) Else Set .Item(s) = Union(.Item(s), Cells(i, 1).Resize(1, lc))
- Next i
- k = .keys
- t = .Items
- End With
- For Each sh In Sheets
- If sh.Name <> "总表" Then sh.Delete
- Next
- Set sh = Sheets("总表")
- For i = 0 To UBound(k)
- sh.Copy After:=Sheets(Sheets.Count)
- With ActiveSheet
- For Each shp In .Shapes
- shp.Delete
- Next
- .Name = k(i)
- .UsedRange.Offset(5).Clear
- t(i).Copy .Cells(6, 1)
- End With
- Next
- sh.Activate
- Application.ScreenUpdating = True
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|