|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
蓝桥老师,可以给我这个代码释一下吗??
- Sub AwTest()
- Dim i&, j%, arr, d As Object
- Set d = CreateObject("Scripting.Dictionary")
- arr = Sheet2.[a1].CurrentRegion
- For i = 2 To UBound(arr)
- For j = 1 To UBound(arr, 2) - 2
- If Len(arr(i, j)) Then d(arr(i, j)) = d(arr(i, j)) + arr(i, UBound(arr, 2) - 1) - arr(i, UBound(arr, 2))
- Next
- Next
- Sheet11.Activate
- arr = Range("O3:O" & Cells(Rows.Count, "O").End(3).Row + 1)
- For i = 1 To UBound(arr) - 1
- If d.exists(arr(i, 1)) Then arr(i + 1, 1) = d(arr(i, 1))
- Next
- Range("O3:O" & Cells(Rows.Count, "O").End(3).Row + 1) = arr
- End Sub
复制代码 |
|