|
楼主 |
发表于 2024-11-20 15:38
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
我还写了一弄了一个就是运行不了,不知道问题出在哪里
- Sub 汇总2() '查询不出来
- Dim arr, brr, crr, Dict As Object, rq As Date, i As Long
-
- Set Dict = CreateObject("Scripting.Dictionary") '
-
- arr = Range("b1").CurrentRegion '
-
- For i = 2 To UBound(arr)
- arr(i, 3) = 0
- Dict(arr(i, 1)) = Array(i, CDate([a2]), CDate([a3]))
-
- Next
-
- brr = Sheets("明细").Range("A1").CurrentRegion
-
- For i = 2 To UBound(brr)
-
- If Dict.exists(brr(i, 8)) Then
-
- crr = Dict(brr(i, 8))
-
- rq = CDate(brr(i, 3))
-
- If rq >= crr(1) Then If rq <= crr(2) Then arr(crr(0), 2) = arr(crr(0), 2) + brr(i, 12)
-
-
- End If
- Next
-
- Range("b1").CurrentRegion = arr
-
- Set Dict = Nothing
-
- End Sub
复制代码 |
|