- ©«¤l
- 1447
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1471
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-11-29
|
¦^´_ 2# Hsieh
ÁÂÁ«e½ú,ÁÂÁ½׾Â
«á¾ÇÂǦ¹©«½d¨Ò½m²ß°}¦C»P¦r¨å,¾Ç²ßªº¤è®×¦p¤U
½Ð«e½úÌ«ü±Ð
°õ¦æ«e:
°õ¦æµ²ªG:
Option Explicit
Sub TEST()
Dim Brr, i&, N&, xR, Y, j&, B&, C&
Set Y = CreateObject("Scripting.Dictionary")
Set xR = Range([Sheet1!D1], [Sheet1!A65536].End(3))
Brr = xR
For i = 2 To UBound(Brr)
If Y(Brr(i, 1)) = "" Then
Y(Brr(i, 1)) = Y.Count + 1: N = Y(Brr(i, 1))
For j = 1 To UBound(Brr, 2): Brr(N, j) = Brr(i, j): Next
Else
N = Y(Brr(i, 1))
For j = 2 To 3: Brr(N, j) = Brr(N, j) + Brr(i, j): Next
End If
B = B + Brr(i, 2): C = C + Brr(i, 3)
Next
With xR.Item(1, 14).Resize(Y.Count + 1, UBound(Brr, 2))
.EntireColumn.Clear: .Value = Brr: .Item(Y.Count + 2, 1) = "Á`p"
.Item(Y.Count + 2, 2) = B: .Item(Y.Count + 2, 3) = C
End With
Set Y = Nothing: Set xR = Nothing: Erase Brr
End Sub |
|