|
参与一下。。。。
- Sub ykcbf() '//2024.4.9
- Dim arr, d
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Set d = CreateObject("Scripting.Dictionary")
- For Each sht In Sheets
- If sht.Name <> "总表" And sht.Name <> "模板" Then
- sht.Delete
- End If
- Next
- With Sheets("总表")
- r = .Cells(.Rows.Count, "a").End(xlUp).Row
- arr = .[a1].Resize(r, 16)
- End With
- For i = 2 To UBound(arr)
- s = arr(i, 15)
- If Not d.exists(s) Then Set d(s) = CreateObject("Scripting.Dictionary")
- d(s)(i) = i
- Next
- On Error Resume Next
- For Each k In d.keys
- m = 0
- Sheets("模板").Copy after:=Sheets(Sheets.Count)
- Set sht = Sheets(Sheets.Count)
- ReDim brr(1 To 100, 1 To 9)
- With sht
- .Name = k
- .[j3] = k
- Sum = 0
- .DrawingObjects.Delete
- For Each kk In d(k).keys
- m = m + 1
- If m = 1 Then r = kk
- .[j4] = arr(r, 11)
- .[g4] = arr(r, 9)
- .[c4] = arr(r, 12)
- .[j20] = arr(r, 14)
- For j = 1 To UBound(arr, 2)
- brr(m, j) = arr(kk, j)
- Next
- brr(m, 9) = arr(kk, 16)
- Sum = Sum + brr(m, 9)
- Next
- .[b6:b18].NumberFormatLocal = "@"
- .[i6:i18].NumberFormatLocal = "0%"
- .[b6].Resize(m, 9) = brr
- .[j19] = Sum
- End With
- Next
- Sheets("模板").Select
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|