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

[µo°Ý] ½Ð°Ý«ç¼Ë´M§ä¬Û¦Pªº¸ê®Æ

[µo°Ý] ½Ð°Ý«ç¼Ë´M§ä¬Û¦Pªº¸ê®Æ

¥»©«³Ì«á¥Ñ john2006168 ©ó 2011-8-27 17:48 ½s¿è

½Ð°Ý ,§Ú¦³2­Ó sheets,¥Îsheet1ªºpart no,´M§ä¸ê®Æ®w§äsheet2(¸ê®Æ®w)¬Û¦Pªºpart no,¦p§ä¨ì ¦bsheet1 ¶ñ¤W ¸ê®Æ®wªº"ref no",

¦ý¬O¸ê®Æ®w¤º¦³¨Ç¬Û¦Pªºpart no¦³2­Óref.,½Ð°Ý §ÚÀ³¸ÓÂI§ï¤U¦Cµ{§Ç,§Ú¬O·s¤â½Ð¦Ñ®v«ü¾É.


Sub testchecking() test.rar (7.8 KB)


Dim i As Integer
Dim j As Integer
Dim RANGE As String

For i = 3 To Sheet1.RANGE("c65536").End(xlUp).Row
For j = 2 To Sheet2.RANGE("E65536").End(xlUp).Row

    If Sheet1.Cells(i, 3).Value = Sheet2.Cells(j, 5).Value Then

        Sheet1.Cells(i, 12).Value = Sheet2.Cells(j, 2).Value
        
        ElseIf Sheet1.Cells(i, 3).Value <> Sheet2.Cells(j, 5).Value Then
Sheet1.Cells(i, 12).Value = "No received"

   
    ElseIf Sheet1.Cells(i, 2).Value = "" Then Sheet1.Cells(i, 12).Value = ""
   

End If

    If Sheet1.Cells(i, 3).Value = Sheet2.Cells(j, 5).Value Then
   
Sheet1.Cells(i, 12).Value = Sheet2.Cells(j, 2).Value
    Sheet1.Cells(i, 13).Value = Sheet2.Cells(j, 1).Value

   

   
i = i + 1
End If
    Next
    Next
   
   
End Sub

¦^´_  john2006168
Dictionary ª«¥ó  D(Key->ÃöÁä¦r) = Item ->¹ïÀ³¶µ¥Ø
D(E.Value) = Array(E.Offset(, ...
GBKEE µoªí©ó 2011-8-29 14:33



    Thanks.

TOP

¦^´_ 4# john2006168
Dictionary ª«¥ó  D(Key->ÃöÁä¦r) = Item ->¹ïÀ³¶µ¥Ø
D(E.Value) = Array(E.Offset(, -3), E.Offset(, -4))
D(E.Value)(0) = Array(0)
D(E.Value)(1) = Array(1)

TOP

¦^´_  john2006168
¨Ï¥ÎDictionary ª«¥ó   ¸Õ¸Õ¬Ý
GBKEE µoªí©ó 2011-8-28 15:56



    ¥t¥~·Q°Ý D(E.Value)(0), (0)¬O¤°»ò·N«ä??
D(E.Value)(1), (1)¬O¤°»ò·N«ä??

TOP

¦^´_ 2# GBKEE


  It is ok, ¦hÁ¦Ѯv©â®É¶¡¦^ÂÐ.

TOP

¦^´_ 1# john2006168
¨Ï¥ÎDictionary ª«¥ó   ¸Õ¸Õ¬Ý
  1. Sub Ex()
  2.     Dim D As Object, E, S As String, S1 As String
  3.     Set D = CreateObject("SCRIPTING.DICTIONARY")
  4.     With Sheets("Sheet2")
  5.         For Each E In .Range("E2", .[E2].End(xlDown))
  6.             If D.EXISTS(E.Value) = False Then
  7.                 D(E.Value) = Array(E.Offset(, -3), E.Offset(, -4))
  8.             Else
  9.                 S = "," & D(E.Value)(0) & ","
  10.                 If InStr(S, "," & E.Offset(, -3) & ",") = 0 Then
  11.                     S = D(E.Value)(0) & "," & E.Offset(, -3)
  12.                 Else
  13.                     S = D(E.Value)(0)
  14.                 End If
  15.                 S1 = "," & D(E.Value)(1) & ","
  16.                 If InStr(S1, "," & E.Offset(, -4)) & "," = 0 Then
  17.                     S1 = D(E.Value)(1) & "," & E.Offset(, -4)
  18.                 Else
  19.                     S1 = D(E.Value)(1)
  20.                 End If
  21.                 D(E.Value) = Array(S, S1)
  22.             End If
  23.         Next
  24.     End With
  25.     With Sheets("Sheet1")
  26.         For Each E In .Range("C3", .[C3].End(xlDown))
  27.             If D.EXISTS(E.Value) Then
  28.                  E.Offset(, 9) = D(E.Value)(0)
  29.                  E.Offset(, 10) = D(E.Value)(1)
  30.             Else
  31.                 E.Offset(, 9) = "No received"
  32.                 E.Offset(, 10) = ""
  33.             End If
  34.             
  35.         Next
  36.     End With
  37. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¡i»X½ªªº¦Û¥Ñ¡j¤H±`¦b¤°»ò³£¥i¥H¦Û¥Ñ¦Û¦bªº®É­Ô¡A«o³Q³oºØÀH¤ß©Ò±ýªº¦Û¥Ñ»X½ª¡AµêÂY®É¥ú¦Ó²@µLıª¾¡C
ªð¦^¦Cªí ¤W¤@¥DÃD