|
楼主 |
发表于 2024-6-23 08:02
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
真的很怪啊,我昨晚确实是true,今天早上打开电脑又正常啊,而且我昨天还改了代码,
Sub cc()
Dim DicA As Object, i%, j%, k%, arr, brr(1 To 4), krr
Set DicA = CreateObject("scripting.dictionary")
k = Range("a1").CurrentRegion.Rows.Count
For i = 2 To k
Debug.Print Cells(i, "g"), DicA.exists(Cells(i, "g").Value)'这里也都是true
If DicA.exists(Cells(i, "g").Value) Then
brr(1) = DicA(Cells(i, "g").Value)(1) + 1
brr(2) = Cells(i, 3) + DicA(Cells(i, "g").Value)(2)
brr(3) = Cells(i, 4) + DicA(Cells(i, "g").Value)(3)
brr(4) = Cells(i, 5) + DicA(Cells(i, "g").Value)(4)
DicA(Cells(i, "g").Value) = brr
Else
brr(1) = 1
brr(2) = Cells(i, 3)
brr(3) = Cells(i, 4)
brr(4) = Cells(i, 5)
DicA(Cells(i, "g").Value) = brr
End If
Next
krr = DicA.keys
For j = 0 To UBound(krr)
Cells(j + 2, "j").Resize(1, 4) = DicA(krr(j))
Next
End Sub
今天早上这段代码也正常,好奇怪! |
|