|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
参与一下。。。
- Sub ykcbf() '//2024.5.21
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("原表")
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .[a1].Resize(r, 6)
- For i = 3 To UBound(arr)
- s = Day(arr(i, 1)) & "|" & arr(i, 3) & "|" & arr(i, 5)
- d(s) = d(s) + arr(i, 6)
- Next
- r = .Cells(Rows.Count, "k").End(3).Row
- arr = .[k1].Resize(r, 9)
- For i = 3 To UBound(arr)
- rq = Split(arr(i, 1), ".")(2)
- s = rq & "|" & arr(i, 2) & "|" & arr(i, 9)
- d(s) = d(s) + arr(i, 3)
- Next
- End With
- With Sheets("每日数据")
- r = .Cells(Rows.Count, 2).End(3).Row
- For i = 3 To r
- For j = 14 To 44
- s = .Cells(2, j) & "|" & .Cells(i, 2) & "|" & .Cells(i, 3)
- If d.exists(s) Then
- .Cells(i, j) = d(s)
- Else
- .Cells(i, j) = ""
- End If
- Next
- Next
- End With
- Set d = Nothing
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
2
查看全部评分
-
|