|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
参与一下。。。
- Sub ykcbf() '//2024.1.9
- Dim d, i%, arr, sh As Worksheet, sht As Worksheet, k, kk
- Set d = CreateObject("scripting.dictionary")
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Dim tm: tm = Timer
- Set sh = ThisWorkbook.Sheets("模板")
- For Each sht In Sheets
- If sht.Name <> "总表" And sht.Name <> sh.Name Then
- sht.Delete
- End If
- Next
- arr = Sheets("总表").UsedRange
- For i = 1 To UBound(arr)
- s = Format(Split(CDate(arr(i, 5)))(0), "yyyy-m-d")
- If Not d.Exists(s) Then
- Set d(s) = CreateObject("scripting.dictionary")
- End If
- d(s)(i) = i
- Next i
- For Each k In d.keys
- Sheets("模板").Copy after:=Sheets(Sheets.Count)
- Set sht = Sheets(Sheets.Count)
- m = 0
- ReDim brr(1 To d(k).Count, 1 To 3)
- With sht
- .Name = k
- rq = "日期: " & Format(CDate(k), "yyyy年m月d日")
- For Each kk In d(k).keys
- m = m + 1
- brr(m, 1) = m
- brr(m, 2) = CStr(arr(kk, 3))
- brr(m, 3) = arr(kk, 4)
- Next
- .Columns(2).NumberFormatLocal = "@"
- .[a9].Resize(m, 3) = brr
- .[c40] = m & " 辆"
- .[l41] = rq: .[l43] = rq
- End With
- Next k
- Sheets("总表").Activate
- Set d = Nothing
- Application.DisplayAlerts = True
- Application.ScreenUpdating = True
- MsgBox "共用时:" & Format(Timer - tm) & "秒!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|