- ©«¤l
- 254
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 310
- ÂI¦W
- 0
- §@·~¨t²Î
- W10
- ³nÅ骩¥»
- Excel 2016
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2019-6-16
- ³Ì«áµn¿ý
- 2024-9-23
|
¦^´_ 30# wei9133
§A§â jcchiang«e½úªº ¥H¤U³o¬q§ï¤@¤U ¬Ý¬Ý ¬O¤£¬O§Anªºµ²ªG
Sub ex3()
Dim d As Object, ar As Object, r
Dim i%, AA$, a
Application.ScreenUpdating = False
Set d = CreateObject("Scripting.Dictionary")
Set ar = Sheets(1).[a1].CurrentRegion
For i = 1 To ar.Rows.Count
AA = Join(Application.Transpose(Application.Transpose(ar(i, 1).Resize(, 102))), ",") & "," & ar(i, 106) '«Ø¥ß§PÂ_±ø¥ó
If Not d.exists(AA) Then '¦r¨å¤º¬dµL¸Ó±ø¥ó
a = Application.Transpose(Application.Transpose(ar(i, 1).Resize(, 115)))
If a(103) = "" Then a(103) = 1 '³Ó³õªÅ¥Õ¶ñ¤J1
d(AA) = a '±N¸ê®Æ©ñ¦^¦r¨å
Else
a = Application.Transpose(Application.Transpose(d(AA))) '±N¦r¨å¸ê®Æ¨ú¥X
If ar(i, 103) = "" Then a(103) = a(103) + 1 Else a(103) = a(103) + ar(i, 103) '³Ó³õªÅ¥Õ³Ó³õ²Ö¥[1,¤£¬OªÅ¥Õ«h±NÄæ¦ìȬۥ[
a(105) = a(105) + ar(i, 105) '±Ñ§½²Ö¥[
For Each r In Array(104, 107, 109, 115) '±N³Æµù,DC,DE,DKÄæ¦ì¸ê®Æ¦X¨Ö
If a(r) <> "" And ar(i, r) <> "" Then '¦pªG¦r¨å»PÄæ¦ì³£¦³¸ê®Æ,¨Ï¥Î","¬Û³s
a(r) = a(r) & "," & ar(i, r)
ElseIf a(r) = "" And ar(i, r) <> "" Then '¦pªG¦r¨å¸ê®Æ¬°ªÅ¥Õ,Äæ¦ì¬O¦³¸ê®Æªº,¨Ï¥ÎÄæ¦ì¸ê®Æ
a(r) = ar(i, r)
End If
Next
d(AA) = a '±N¸ê®Æ©ñ¦^¦r¨å
End If
Next
With Sheets(2) '¦b²Ä¤GÓSheet¶ñ¤J¸ê®Æ
.[a1].CurrentRegion.Clear '²M°£Sheet¸ê®Æ
.[a1].Resize(d.Count, 115) = Application.Transpose(Application.Transpose(d.items)) '±N¦r¨å¸ê®Æ¦C¥X
'For Each r In .Range(.[cy2], .[cy2].End(4)) '«O¯d³Ó³õ+1
' r.Value = r.Value + 1
'Next
End With
Set d = Nothing
Application.ScreenUpdating = True
End Sub |
|