|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub lqxs()
- Dim col%, Myr&, Arr, d, k, i&, j&, aa
- Dim Sht As Worksheet, Sht1 As Worksheet
- Set d = CreateObject("Scripting.Dictionary")
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Set Sht1 = ActiveSheet
- For Each Sht In Sheets
- If Sht.Name <> Sht1.Name And Sht.Name <> "模板" Then Sht.Delete
- Next Sht
- col = 2
- On Error Resume Next
- Myr = [b65536].End(xlUp).Row
- Arr = Range("a1:q" & Myr)
- For i = 46 To UBound(Arr)
- d(Arr(i, col)) = d(Arr(i, col)) & i & ","
- Next
- k = d.keys: t = d.items
- For i = 0 To UBound(k)
- Sheets("模板").Copy after:=Sheets(Sheets.Count)
- ActiveSheet.Name = k(i)
- t(i) = Left(t(i), Len(t(i)) - 1)
- If InStr(t(i), ",") Then
- aa = Split(t(i), ",")
- For j = 0 To UBound(aa)
- With ActiveSheet
- .Cells(j + 46, 1).Resize(1, UBound(Arr, 2)) = Application.Index(Arr, aa(j), 0)
- End With
- Next
- Else
- With ActiveSheet
- .Cells(46, 1).Resize(1, UBound(Arr, 2)) = Application.Index(Arr, t(i), 0)
- End With
- End If
- [a46].Select
- Next
- Sht1.Activate
- Set d = Nothing
- Application.DisplayAlerts = True
- Application.ScreenUpdating = True
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|