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

[µo°Ý] ½Ð°ÝVBA¥i¥H°µ¨ì¨âÀɮפñ¹ï«á¦A²£¥Í¥t¤@Àɮתº¤ñ¹ïµ²ªG¶Ü?

¦^´_ 6# GBKEE


    ÁÂÁª©¤j~~~

©êºp¤p©f¤~²¨¾Ç²L...... ½Ð°Ý¤@¤U­n«ç»ò¨Ï¥Î¤~¯à°µ¤ñ¹ï©O?

§Ú±N»yªk½Æ»s¨ì¼Ò²Õ¤¤ ¦ý¬O¦p¦ó¤~¯à¥¿½T¨Ï¥Î?

¥Ø«e°»¿ù°±¦b
With Workbooks("A.xls").Sheets(1)

¹ïVBA«Ü¦³¿³½ì¦ý¬O¥¼¶}¬ ¥Ø«e¸}¨B«ÜºC©|°±¯d¦b¨ç¼Æ¶¥¬q ¤]½Ð¦U¦ì¤j®v­Ì¦h¦h¨£½Ì§Ú°Ýªº²Â°ÝÃD..

TOP

¦^´_ 4# vocolboy
  1. Option Explicit
  2. Sub Ex()
  3.     Dim d As Object, i As Variant, S  As Variant
  4.     Set d = CreateObject("scripting.dictionary")
  5.     i = 1
  6.     With Workbooks("A.xls").Sheets(1)
  7.         Do While .Cells(i, "e") <> ""
  8.             d(.Cells(i, "e").Value) = .Cells(i, "A").Value
  9.             i = i + 1
  10.         Loop
  11.     End With
  12.      i = 1
  13.     With Workbooks("B.xls").Sheets(1)
  14.         Do While .Cells(i, "J") <> ""
  15.            S = Join(Application.Transpose(Application.Transpose(.Range("A" & i & ":J" & i))), ",")
  16.            If d.Exists(.Cells(i, "J").Value) Then
  17.                 S = S & "," & d(.Cells(i, "J").Value)
  18.                 d(.Cells(i, "J").Value) = Split(S, ",")
  19.            Else
  20.                 d(.Cells(i, "J").Value) = Split(S & ",No Data", ",")
  21.                 S = d(.Cells(i, "J").Value)
  22.            
  23.            End If
  24.             i = i + 1
  25.         Loop
  26.     End With
  27.     For Each i In d.keys
  28.         If InStr(i, "-") Then If Mid(i, InStr(i, "-"), 2) <> "-1" Then d.Remove i        '¥i©¿²¤"-"ªº¨BÆJ
  29.     Next
  30.     With Workbooks("C.xls").Sheets(1)
  31.         .Cells.Clear
  32.         S = Application.Transpose(Application.Transpose(d.ITEMS))
  33.         .[A1].Resize(UBound(S, 1), UBound(S, 2)) = S
  34.     End With
  35. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 4# vocolboy


    «¢Åo~~ÁÂÁÂvocolboy ~

½Ð°Ý¤@¤U ¬O§_¥i¥H¦³¤@­ÓÀÉ®× ¶}±Ò¥H«á Åý§Ú«ö¶s¿ï¾Ü¸ü¤J¨â­ÓÀɮפñ¹ï©O?

¨Ò¦p

«ö¶s¤@  ½Ð¿ï¾ÜÀÉ®×
«ö¶s¤G  ½Ð¿ï¾ÜÀÉ®×
«ö¶s¤T  ¶}©l¤ñ¹ï

TOP

¥»©«³Ì«á¥Ñ vocolboy ©ó 2013-7-25 14:48 ½s¿è

¦^´_ 1# happycoccolin

§Ú¤]¬O­è¾Çªº¤£¯à¤U¸ü¥I¥óª½±µ±q§A¤W­zªº¼g

Sub ¤ñ¹ï()
Set d = CreateObject("Scripting.Dictionary")          '¦r¨å
With Workbooks("A.xls").Sheets(1)                       'with ³ø¦W¦WºÙ.¤u§@ªí¦WºÙ
  For Each a In .Range(.[E2], .[E65536].End(xlUp))
   d(a & "") = Array(a.Offset(, -4).Value)
  Next
End With
With Workbooks("B.xls").Sheets(1)                                       
  For Each a In .Range(.[J2], .[J65536].End(xlUp))
    a.Offset(, 1).Resize(, 1).Value = d(a & "")
  Next
End With
End Sub


³o­Óµ²ªG¨Ã¤£·|²£¥Í¨ìC·sªº¤W
¥L·|match¦bB¸Ì­±
§Ú·Q³o¥u¬O­Ó½Æ»s¶K¤W¤p°ÝÃD@@

TOP

¦^´_ 2# happycoccolin


    :$ ­Y¦³ªÅ½Ð¤j®a¬Ý¬Ý¬O§_¥i¥H¹F¦¨~~~ÁÂÁÂ!!!!!

ABC.zip (19.03 KB)

TOP

§Ñ¤FªþÀÉ.....µy«áªþ¤WÀÉ®×~

TOP

        ÀR«ä¦Û¦b : ¤£­n¤p¬Ý¦Û¤v¡A¦]¬°¤H¦³µL­­ªº¥i¯à¡C
ªð¦^¦Cªí ¤W¤@¥DÃD