ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] [¤w¸Ñ¨M]±ø¥ó¦¡¿z¿ï

[µo°Ý] [¤w¸Ñ¨M]±ø¥ó¦¡¿z¿ï

¥»©«³Ì«á¥Ñ planck_100 ©ó 2011-10-14 18:37 ½s¿è

§Ú¦³¤@µ§¸ê®Æ¦p¤U
     A        B       C       D
1  Ä«ªG    ªG¥Ä     ªM       3
2  ­»¿¼    ¹s°â     ¤ç       7
3  Ä«ªG    ¹s°â     Áû       2
4  ªÝ¼Ö    ¹s°â     ­Ó       3
5  ¸²µå    ªG¥Ä     ªM       1
6  ­»¿¼    ¹s°â     ¤ç       2
7  »ñ±ù    ªG¥Ä     ­Ó       9


AÄ欰¤ôªG¦WºÙ
BÄ欰¥Î³~
CÄ欰³æ¦ì
DÄ欰¼Æ¶q

¸g¹L¿z¿ï«á¦A²Ä¤E¦C²£¥Í¿z¿ï«áªº¼Æ­È(¤£­«½Æ¡A¨Ã²Î­p)

       A        B       C       D
9    Ä«ªG    ªG¥Ä     ªM       3
10  ­»¿¼    ¹s°â     ¤ç       9
11  Ä«ªG    ¹s°â     Áû       2
12  ªÝ¼Ö    ¹s°â     ­Ó       3
13  ¸²µå    ªG¥Ä     ªM       1
14  »ñ±ù    ªG¥Ä     ­Ó       9


½Ð°Ý¥ÎVBA­n¦p¦ó¹ê²{?   ÁÂÁ¦U¦ì¤£§[¶Þ«ü±Ð¡C

  1. Sub xx()
  2. Set d = CreateObject("Scripting.Dictionary")
  3. a = [a1].CurrentRegion
  4. For i = 1 To UBound(a)
  5. k = a(i, 1) & a(i, 2)
  6. If Not d.exists(a(i, 1) & a(i, 2)) Then
  7. d(k) = Application.Index(a, i)
  8. Else
  9. d(k) = Array(d(k)(1), d(k)(2), d(k)(3), d(k)(4) + a(i, 4))
  10. End If
  11. Next
  12. [a9].Resize(d.Count, 4) = Application.Transpose(Application.Transpose(d.items))
  13. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ planck_100 ©ó 2011-10-7 23:28 ½s¿è

ÁÂÁ±zªº«ü±Ð¡C


µ{¦¡¤w´ú¸Õ¥¿±`¡A¦A¦¸·PÁ±zªº«ü¾É¡C

TOP

¥»©«³Ì«á¥Ñ planck_100 ©ó 2011-10-8 00:28 ½s¿è

¦^´_ 2# oobird


    ½Ð±Ð¤@­Ó°ÝÃD

[a9].Resize(d.Count, 4) = Application.Transpose(Application.Transpose(d.items))

A9 ¨º­Ó"9" ¥i¥H¥ÎÅܼƨú¥N¶Ü?



¤w¸Ñ¨M

Range("a" & x).Resize(d.Count, 4) = Application.Transpose(Application.Transpose(d.items))

TOP

½Ð±Ð¦U¦ì«e½ú,¬°¦ó·s¼W¨ì²Ä10µ§´N·|,¿ù»~,¶W¥X½d³ò,ÁÂÁÂ.
Sub «ö¶s1_Click()
Set d = CreateObject("Scripting.Dictionary")
a = [a1].CurrentRegion

For i = 1 To UBound(a)
    k = a(i, 1) & a(i, 2)
    If Not d.exists(a(i, 1) & a(i, 2)) Then
       d(k) = Application.Index(a, i)
    Else
       d(k) = Array(d(k)(1), d(k)(2), d(k)(3), d(k)(4) + a(i, 4))
    End If
Next
'[a9].Resize(d.Count, 4) = Application.Transpose(Application.Transpose(d.items))
[f1].Resize(d.Count, 4) = Application.Transpose(Application.Transpose(d.items))
'Range("a" & x).Resize(d.Count, 4) = Application.Transpose(Application.Transpose(d.items))
End Sub
§ù¤p¥­

TOP

        ÀR«ä¦Û¦b : ¯à¥I¥X·R¤ß´N¬OºÖ¡A¯à®ø°£·Ð´o´N¬O¼z¡C
ªð¦^¦Cªí ¤W¤@¥DÃD