- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 1# nelson9165
¸Õ¸Õ¬Ý- Option Explicit
- Sub EX()
- Dim d As Object, i As Long, D_S As String, AR(), E As Range
- Set d = CreateObject("scripting.dictionary") '³]¥ßª«¥ó:¦r¨åª«¥ó
- With Sheets("data") '¸ê®Æ¤u§@¶
- i = 2
- Do While .Cells(i, "A") <> ""
- D_S = .Cells(i, "C") & .Cells(i, "B") & .Cells(i, "A") '¦r¨åª«¥óªº ÃöÁä¦r
- 'Exists ¤èªk ¦pªG¦b Dictionary ª«¥ó¤¤«ü©wªºÃöÁä¦r¦s¦b¡A¶Ç¦^ True¡AY¤£¦s¦b¡A¶Ç¦^ False¡C
- If d.Exists(D_S) Then
- AR = d(D_S) '°}¦C=¦r¨åª«¥óªº¶µ¥Ø
- AR(0) = AR(0) + 1 '¶µ¥Ø Ӽƪº¥[Á`
- AR(1) = AR(1) + .Cells(i, "D") '¶µ¥Ø ¼Æ¦rªº¥[Á`
- d(D_S) = AR
- Else
- d(D_S) = Array(1, .Cells(i, "D").Value) '¦r¨åª«¥óªº¶µ¥Ø¾É¤J°}¦C
- End If
- i = i + 1
- Loop
-
- End With
-
- With Sheets("¤u§@ªí1")
- .Range("B9:I16") = "" '²M°£¸ê®Æ¤£§tCode
- For Each E In .Range("A9:A16") 'CodeÄ檺½d³ò
- D_S = .Range("D6") & E '¤é´Á & Code
- If d.Exists(D_S & "A") Then
- E.Range("D1") = d(D_S & "A")(0)
- E.Range("G1") = d(D_S & "A")(1)
- End If
- If d.Exists(D_S & "B") Then
- E.Range("E1") = d(D_S & "B")(0)
- E.Range("H1") = d(D_S & "B")(1)
- End If
- E.Range("F1") = E.Range("D1") + E.Range("E1")
- E.Range("I1") = E.Range("G1") + E.Range("H1")
- Next
- End With
-
- End Sub
½Æ»s¥N½X |
|