|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub lqxs()
- Dim Arr, i&, x$, y$, k, t, kk, tt, d, j&, n&, r1, m&
- Set d = CreateObject("Scripting.Dictionary")
- Sheet2.Activate
- [b3:c500].ClearContents
- Arr = Sheet1.[a1].CurrentRegion
- For i = 2 To UBound(Arr)
- x = Arr(i, 1): y = Arr(i, 2)
- If d.exists(x) = False Then Set d(x) = CreateObject("Scripting.Dictionary")
- d(x)(y) = d(x)(y) + Arr(i, 3) '
- Next
- k = d.keys: t = d.items
- For i = 0 To UBound(k)
- Set r1 = [a:a].Find(k(i), , , 1)
- m = r1.Row
- kk = t(i).keys: tt = t(i).items
- For j = 0 To UBound(kk)
- n = m + j
- Cells(n, 2) = kk(j): Cells(n, 3) = tt(j)
- Next
- Next
- End Sub
复制代码 |
|