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

½Ð°Ý¦p¦ó±N¤u§@ªí¤À¥tÀx¦s¦¨¤£¦PÀÉ®×

½Ð°Ý¦p¦ó±N¤u§@ªí¤À¥tÀx¦s¦¨¤£¦PÀÉ®×

½Ð°Ý¦U¦ì°ª¤â

½Ð°Ý¯à§_¸ò¾Ú¤U­±¸ê®Æ
±N¦³Ãö¤u§@ªí¥t¦s¦¨­Ó§OÀÉ®×,¨Ò¦p:
ÀÉ®×AA ¥]¬A ¤u§@ªíAA, sheet1, sheet2, sheet3
ÀÉ®×BB ¥]¬A ¤u§@ªíAA, sheet4, sheet5, sheet6, sheet7, sheet8

¤u§@ªí1        ¤u§@ªí2
AA        sheet1
AA        sheet2
AA        sheet3
BB        sheet4
BB        sheet5
BB        sheet6
BB        sheet7
BB        sheet8

½Ð¦h¦h«ü±Ð

¶×¥XÀÉ®×.zip (14.48 KB)

¦^´_ 1# enoch
  1. Sub nn()
  2. fd = "E:\Test\" '¥Ø¼Ð¸ê®Æ§¨
  3. Set d = CreateObject("Scripting.Dictionary")
  4. With Sheets("Summary")
  5. For Each a In .Range(.[A2], .[A65536].End(xlUp))
  6.    If IsEmpty(d(a.Value)) Then
  7.      d(a.Value) = a & "," & a.Offset(, 1)
  8.      Else
  9.      d(a.Value) = d(a.Value) & "," & a.Offset(, 1)
  10.    End If
  11. Next
  12. For Each ky In d.keys
  13.   sh = Split(d(ky), ",")
  14.   fs = fd & ky & ".xls"
  15.   Sheets(sh).Copy
  16.   With ActiveWorkbook
  17.   .SaveAs fs
  18.   .Close
  19.   End With
  20. Next
  21. End With
  22. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

Hsieh

ÁÂÁ§A
¦ýÁÙ¦³¤Ö¤Ö°ÝÃD,
·í­«·s°õ¦æ¥¨¶°®É,
¦]¬°Àɤw¦s¦b¦Ó¥X²{ERROR
½Ð°Ý¦p¦ó¥i¥H¦Û°Ê¨ú¥N²{¦³ÀÉ®×

enoch

TOP

¦^´_ 3# enoch
  1. Sub nn()
  2. fd = "E:\Test\" '¥Ø¼Ð¸ê®Æ§¨
  3. Set d = CreateObject("Scripting.Dictionary")
  4. With Sheets("Summary")
  5. For Each a In .Range(.[A2], .[A65536].End(xlUp))
  6.    If IsEmpty(d(a.Value)) Then
  7.      d(a.Value) = a & "," & a.Offset(, 1)
  8.      Else
  9.      d(a.Value) = d(a.Value) & "," & a.Offset(, 1)
  10.    End If
  11. Next
  12. For Each ky In d.keys
  13.   sh = Split(d(ky), ",")
  14.   fs = fd & ky & ".xls"
  15.   Sheets(sh).Copy
  16.   With ActiveWorkbook
  17.   If Dir(fs) <> "" Then Kill fs
  18.   .SaveAs fs
  19.   .Close
  20.   End With
  21. Next
  22. End With
  23. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

Hsieh

ÁÂÁ§A,°ÝÃD¤w¸Ñ¨M

enoch

TOP

­YªG¦P¤@°ÝÃD,¦ý¦³³¡¥÷¤£¬O¤u§@ªí, ¦Ó¬OÀÉ®×¥i¥H¶Ü?
¨Ò¦p:
ÀÉ®×AA ¥]¬A ¤u§@ªíAA, sheet1, sheet2, book1.xls
ÀÉ®×BB ¥]¬A ¤u§@ªíAA, sheet4, sheet5, sheet6, book2.xls, book3.xls

¤u§@ªí1        ¤u§@ªí2
AA        sheet1
AA        sheet2
AA        book1.xls
BB        sheet4
BB        sheet5
BB        sheet6
BB        book2.xls
BB        book3.xls

TOP

ª©¥D¤j¤j§A¦n¡G

  ½Ð°Ý¬°¦ó¦¹»yªk¬O¥Î
For Each ky In d.keys¤~¯à¨ú¥Xitems¸ê®Æ¡A
¦Ó¬°¦óFor Each ky In d.items´NµLªk¨ú¥X¸ê®Æ©O¡H

·P®¦¤j¤j¡I

TOP

¦^´_ 7# dechiuan999
For Each ky In d.keys
       d( ky)      ->items
Next
For Each ky In d.items      
     ky    ->items
Next

TOP

ÁÂÁª©¥D¤j¤j¡C
For Each ky In d.keys
       d( ky)      ->items
Next
For Each ky In d.items      
     ky    ->items
Next
dictionary¯uÅý¤HµÛ°g¡A
¤]¦n²`¶ø®@¡I
²LÅã¨Ò¤l¤]¯àÅã¥Ü¥X¦p¦¹ÅܤơC
¯uÅý¤H¨ü¯q¨}¦h¡C
·P®¦ª©¥D¤j¤j¡C

TOP

        ÀR«ä¦Û¦b : ÁÀ¨¥¹³¤@¦·²±¶}ªºÂAªá¡A¥~ªí¬üÄR¡A¥Í©Rµu¼È¡C
ªð¦^¦Cªí ¤W¤@¥DÃD