- ©«¤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¿ý
- 2025-3-24
|
¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-5-9 08:20 ½s¿è
ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú
«á¾ÇÂǦ¹©«½m²ß°}¦C»P¦r¨å,¾Ç²ß¤è®×¦p¤U,½Ð¦U¦ì«e½ú«ü±Ð
Option Explicit
Sub TEST_1()
Dim Brr, Y, i&, j%
'¡ô«Å§iÅܼÆ
Set Y = CreateObject("Scripting.Dictionary")
'¡ô¥OYÅܼƬO¦r¨å
Brr = Range([G1], [A65536].End(xlUp))
'¡ô¥OÅܼƬO¤Gºû°}¦C¨Ã¥HÀx¦s®æÈˤJ
For i = 2 To UBound(Brr)
'¡ô³]¶¶°j°é
If Y(Brr(i, 1)) = "" Then
'¡ô³oºÃ°Ý¥y¤w¸g¤£ª¾¤£Ä±±N key¬OBrr(i, 1),item¬O"" ,¯Ç¤J¦bY¦r¨å¤¤¤F
Y(Brr(i, 1)) = Y.Count
'¡ô¯Á©Ê´N¨Ì·í¤Ukeyªº¼Æ¶q·íÅܼƬö¿ý¦¹key¦b°}¦C¤¤ªº¯Á¤Þ¦C¸¹
For j = 1 To 7: Brr(Y.Count, j) = Brr(i, j): Next: GoTo i01
'¡ô¦]¬°¬Oº¦¸¯Ç¤J¦¹key,©Ò¥H±N¦UÄæ¦ìȱa¤J«ü©w¦ì¸m,Âл\°}¦CÈ,
'¡ô¥H¤W´N¤w¸g³B²z¤Fº¦¸È,¤£¥²²Ö¥[ª÷ÃB,©Ò¥H¸õ¨ìi01«ü©w¦ì¸mÄ~Äò°õ¦æ
End If
Brr(Y(Brr(i, 1)), 5) = Brr(Y(Brr(i, 1)), 5) + Brr(i, 5)
'¡ô¦pªGµ{§Ç¯à¶]¨ì³o¸Ì,¥Nªí¤£¬Oº¦¸,±N¸Ókey©Ò±aªºitem½Õ¥X¨Ó(¯Á¤Þ¦C¸¹),
'Åýª÷ÃB°µ²Ö¥[
i01: Next
[J:P].ClearContents
'¡ô²M°£µ²ªGÀx¦s®æ¸ê®Æ
If Y.Count > 0 Then [J1].Resize(Y.Count, 7) = Brr
'¡ô¦pªG¦r¨å¸Ì¦³keys!´N±q[J1]¶}©l¶K¤JBrr°}¦C§½³¡È
Set Y = Nothing: Erase Brr
'¡ôÄÀ©ñÅܼÆ
End Sub |
|