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

¦p¦ó±q¤£¦Pªí¶i¦æ¤£¦P¦C½Æ»s¸ê®Æ?

¦p¦ó±q¤£¦Pªí¶i¦æ¤£¦P¦C½Æ»s¸ê®Æ?

sheet1ªí¨C¨âÄ欰¸ê®Æ°Ï¶ô, ¨ä­º¦C§¡¦³¬Û¦P¥N½X©M¦C¼Æ¦pA,C,E,G,I,K,M,O,QÄæ, ¦Ó¦¸¦C¦pB,D,F,H,J,L,N,P,©MRÄ欰¸ê®Æ¤º®e, ¦U¦³4000¸ê®Æ¦C.

sheet3ªíA:DÄæªí¥Ü±ýÅܧ󪺸ê®Æ¤º®e, ¨ä¤¤A:BÄ楲¶·¹ïsheet1ªíA:B»PK:L°µ¸ê®Æ´À´«¦psheet3ªí©Ò¹ïÀ³ªºB1:B2Àx¦s®æ¤º®e¬°XX01©MXX02­n«þ¨©¦Üsheet1ªíB1:B2Àx¦s®æ©ML1:L2Àx¦s®æ, ©¹¤U¾l¦¹Ãþ±Àª½¨ìA:BÄæµL¸ê®Æ¡C¦P²z, sheet3 ªíC:DÄæ¤]­n¹ïsheet1ªí°µ¸ê®Æ´À´«¦psheet3ªí©Ò¹ïÀ³ªºD1:D2Àx¦s®æ¤º®e¬°YY01©MYY02­n«þ¨©¦Üsheet1ªíD1:D2Àx¦s®æ,F1:F2Àx¦s,H1:H2Àx¦s,J1:J2Àx¦s,N1:N2Àx¦s,P1:P2Àx¦s,R1:R2Àx¦s,D1:D2Àx¦s©ML1:L2Àx¦s®æ, ©¹¤U¾l¦¹Ãþ±Àª½¨ìC:DÄæµL¸ê®Æ¦pªþÀɵ²ªG»¡©ú.

¦p¦ó±q¤£¦Pªí¶i¦æ¤£¦P¦C½Æ»s¸ê®Æ?

·Ð½Ð¥ý¶i ¤j¤j«ü¾É
TEST18.rar (25.2 KB)

¦^´_ 1# luke
  1. Sub xx()
  2. Set d1 = CreateObject("Scripting.Dictionary")
  3. Set d2 = CreateObject("Scripting.Dictionary")
  4. With Sheet3
  5.   For Each R In .Range("A1:A" & .[A1].End(xlDown).Row)
  6.     d1(R.Value) = R.Offset(0, 1).Value
  7.     d2(R.Value) = R.Offset(0, 3).Value
  8.   Next
  9. End With
  10. With Sheet1
  11.   For Each R In .Range("A1:A" & .[A1].End(xlDown).Row)
  12.     If d1.exists(R.Value) Then
  13.       Set Rng1 = Union(R.Offset(0, 1), R.Offset(0, 11))
  14.       Rng1.Value = d1(R.Value)
  15.       Set Rng2 = Union(R.Offset(0, 3), R.Offset(0, 5), R.Offset(0, 7), R.Offset(0, 9), R.Offset(0, 13), R.Offset(0, 15), R.Offset(0, 17))
  16.       Rng2.Value = d2(R.Value)
  17.     End If
  18.   Next
  19. End With
  20. End Sub
½Æ»s¥N½X

TOP

¦^´_ 2# register313


ÁÂÁÂH¤j
   
sheet3ªíH1Àx¦s®æ¬O§_¥i³]©w§@¬°ÅܼÆ
·íH1­È=1®É,¶È½Æ»ssheet3ªíBÄæ¸ê®Æ¦Üsheet1ªíªºBÄæ©M½Æ»ssheet3ªíDÄæ¸ê®Æ¦Üsheet1ªíªºDÄæ
·íH1­È=2®É, ½Æ»ssheet3ªíBÄæ¸ê®Æ¦Üsheet1ªíªºBÄæ©M½Æ»ssheet3ªíDÄæ¸ê®Æ¦Üsheet1ªíªºDÄæ©MFÄæ
·íH1­È=3®É, ½Æ»ssheet3ªíBÄæ¸ê®Æ¦Üsheet1ªíªºBÄæ©M½Æ»ssheet3ªíDÄæ¸ê®Æ¦Üsheet1ªíªºDÄæ, FÄæ©MHÄæ
·íH1­È=4®É, ½Æ»ssheet3ªíBÄæ¸ê®Æ¦Üsheet1ªíªºBÄæ©M½Æ»ssheet3ªíDÄæ¸ê®Æ¦Üsheet1ªíªºDÄæ, FÄæ, HÄæ©MJÄæ
·íH1­È=5®É, ½Æ»ssheet3ªíBÄæ¸ê®Æ¦Üsheet1ªíªºBÄæ©MLÄæ, ¨Ã½Æ»ssheet3ªíDÄæ¸ê®Æ¦Üsheet1ªíªºDÄæ, FÄæ, HÄæ©MJÄæ
·íH1­È=6®É, ½Æ»ssheet3ªíBÄæ¸ê®Æ¦Üsheet1ªíªºBÄæ©MLÄæ, ¨Ã½Æ»ssheet3ªíDÄæ¸ê®Æ¦Üsheet1ªíªºDÄæ, FÄæ, HÄæ, JÄæ©MNÄæ
·íH1­È=7®É, ½Æ»ssheet3ªíBÄæ¸ê®Æ¦Üsheet1ªíªºBÄæ©MLÄæ, ½Æ»ssheet3ªíDÄæ¸ê®Æ¦Üsheet1ªíªºDÄæ, FÄæ, HÄæ , JÄæ, NÄæ©MPÄæ

¦p¦ó­×§ïµ{¦¡

·Ð½Ð¥ý¶i ¤j¤j«ü¾É
TEST18A.rar (15.69 KB)

TOP

¦^´_ 3# luke
  1. Sub xx()
  2. Dim Rng1 As Range
  3. Dim Rng2 As Range
  4. Set d1 = CreateObject("Scripting.Dictionary")
  5. Set d2 = CreateObject("Scripting.Dictionary")
  6. With sheet3
  7.   For Each R In .Range("A1:A" & .[A1].End(xlDown).Row)
  8.     d1(R.Value) = R.Offset(0, 1).Value
  9.     d2(R.Value) = R.Offset(0, 3).Value
  10.   Next
  11. End With
  12. X = sheet3.[H1]
  13. Ar = Switch(X = 1, Array(2), X = 2, Array(2), X = 3, Array(2), X = 4, Array(2), X = 5, Array(2, 12), X = 6, Array(2, 12), X = 7, Array(2, 12))
  14. Br = Switch(X = 1, Array(4), X = 2, Array(4, 6), X = 3, Array(4, 6, 8), X = 4, Array(4, 6, 8, 10), X = 5, Array(4, 6, 8, 10), X = 6, Array(4, 6, 8, 10, 14), X = 7, Array(4, 6, 8, 10, 14, 16))
  15. With sheet1
  16.   For Each R In .Range("A1:A" & .[A1].End(xlDown).Row)
  17.     If d1.exists(R.Value) Then
  18.       For I = 0 To UBound(Ar)
  19.         If Rng1 Is Nothing Then Set Rng1 = .Cells(R.Row, Ar(I)) Else Set Rng1 = Union(Rng1, .Cells(R.Row, Ar(I)))
  20.       Next I
  21.       Rng1.Value = d1(R.Value)
  22.       Set Rng1 = Nothing
  23.       For j = 0 To UBound(Br)
  24.         If Rng2 Is Nothing Then Set Rng2 = .Cells(R.Row, Br(j)) Else Set Rng2 = Union(Rng2, .Cells(R.Row, Br(j)))
  25.       Next j
  26.       Rng2.Value = d2(R.Value)
  27.       Set Rng2 = Nothing
  28.     End If
  29.   Next
  30. End With
  31. End Sub
½Æ»s¥N½X

TOP

¦^´_ 4# register313


    ÁÂÁÂR¤j

   ¨¯­W»P¥I¥X

TOP

        ÀR«ä¦Û¦b : ¡i°±º¢¤£«e¡A²×µL©Ò±o¡j¤H³£°g©ó´M§ä©_ÂÝ¡A¦]¦Ó°±º¢¤£«e¡FÁa¨Ï®É¶¡¦A¦h¡B¸ô¦Aªø¡A¤]¤FµL¥Î³B¡A²×µL©Ò±o¡C
ªð¦^¦Cªí ¤W¤@¥DÃD