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

[µo°Ý] ³øªí®ø±b¦©°£¼Æ¶q

[µo°Ý] ³øªí®ø±b¦©°£¼Æ¶q

½Ð±Ð¤@¤U¦U¦ì¤j®v¡A¥Ø«e³øªí»Ý¨Ï¥Î¨ìÃþSAP¥\¯à.
¨Ò¦pªþ¥ó¤¤DÄæ¦p¦³¹ïÀ³¨ì¦UÂI¡A¦UÂIÁ`¶q¦©°£ÁʶR¶qªº³Ñ¾l¼Æ.
·PÁ¤j®v­Ì«ü¾É.
¼Æ¶q¦©ªk.rar (7.02 KB)

¦^´_ 1# home1913


    ¥i§_¦A¸Ô²ÓÂI¸Ñ»¡
ss

TOP

¦pD3.D4¨Ó»¡,¼Æ¶q=A2«e7½X¹ïÀ³¨ì(G1:K1)«á,D3.D4»Ý¨Ï¥Î¥kªí¤¤¬Û¦P³f¸¹¤§¼Æ¶q¦©°£C3.C4«áªº¼Æ¶q.
¦ÓD6¼Æ¶q=A5«e7½X¹ïÀ³¨ì(G1:K1)«á,¦©°£¥ý«e³Ñ¾lªº¼Æ¶q(EX3-C6).

PS.±ø¥óAÄ楲¶·­n©M¥kªí(G1:K1)¦³¬Û¹ïÀ³¤~¥i¦©°£¬Û¦P³f¸¹ªº¼Æ¶q.
¥H¤W.·PÁÂ

TOP

¦^´_ 3# home1913
¸Õ¸Õ¬Ý:
  1. Option Base 1
  2. Option Explicit
  3. Private Sub CommandButton1_Click()
  4.     Dim i, j, ¦C¼Æ, Barcode¼Æ, ­ì®w¦s¶q As Integer
  5.     Dim code1, code2, Äæ¦W As String
  6.     Dim findCell, findRng As Range
  7.    
  8.     Barcode¼Æ = [B1].End(xlDown).Row - 1
  9.     '1. ´¡¤J»²§UÄæ ÄæA(¤â°Ê)
  10.    
  11.     '2. ±N ÄæC ³f¸¹¦X¨Ö, ¥B ÄæA ¶ñ¤J»¼¼W¼Æ¦C
  12.     [C2].Resize(Barcode¼Æ, 1) = ""
  13.     [E2].Resize(Barcode¼Æ, 1) = ""
  14.     For i = 2 To Barcode¼Æ + 1
  15.         Cells(i, 1) = i
  16.         If Left(Cells(i, 2), 1) = "w" Then
  17.             code1 = Left(Cells(i, 2), 7)
  18.         Else
  19.             code2 = Left(Cells(i, 2), 6)
  20.             Cells(i, 3) = code1 & code2
  21.         End If
  22.     Next
  23.    
  24.     '3. «ö ¥DÁä ÄæC, ¦¸Áä ÄæA »¼¼W±Æ§Ç
  25.     [A1].Resize(Barcode¼Æ + 1, 5).Sort _
  26.            Key1:=Range("C1"), Order1:=xlAscending, _
  27.            Key2:=Range("A1"), Order2:=xlAscending, _
  28.            Header:=xlYes
  29.               
  30.     '4. ­«·s¼g¤J¤½¦¡, ¨¾¾Þ§@¤£¤p¤ß§R±¼¤½¦¡
  31.     [F3] = "=MATCH(F2,G2:G7,0)"    '0 ¡÷ºë½T¬d¸ß, ¤£¥i¬Ù²¤, Lookup_array ¥i¥H¨Ì¥ô·N¦¸§Ç±Æ¦C¡C
  32.     [F6] = "=MATCH(F5,H1:L1,0)"    '1 ¡÷¥i¬Ù²¤, §ä¨ìµ¥©ó©Î¶È¦¸©ó lookup_value ªº­È, Lookup_array¥²¶·»¼¼W±Æ§Ç
  33.                                    '-1¡÷¤£¥i¬Ù²¤, ·|§ä¨ìµ¥©ó©Î¤j©ó lookup_value ªº³Ì¤p­È, Lookup_array¥²¶·»¼´î±Æ§Ç
  34.     [F8] = "=INDEX(H2:L7,F3,F6)"   '¶Ç¦^¬d¸ß½d³ò, ¦C»PÄæ ªº¥æ义ÂIªº­È
  35.    
  36.     '¥H¤W¤T¦C¬° ®w¦sªí©T©w¤j¤p ¨Ï¥Î,
  37.     '­Y ®w¦sªí©T©w¤j¤p ·|ÅÜ°Ê, ½Ð§ï¥Î¤U¦C¤­¦C
  38. '    ¦C¼Æ = CStr([G1].End(xlDown).Row)
  39. '    Äæ¦W = Chr([G1].End(xlToRight).Column + 63)
  40. '    [F3] = "=MATCH(F2,G2:G" & ¦C¼Æ & ",0)"
  41. '    [F6] = "=MATCH(F5,H1:" & Äæ¦W & "1,0)"
  42. '    [F8] = "=INDEX(H2:" & Äæ¦W & "7,F3,F6)"
  43.    
  44.     '5. ¥Dµ{¦¡
  45.     i = 1
  46.     Do
  47.         i = i + 1
  48.         If Cells(i, 3) = "" Then GoTo done1:
  49.         [F5] = Left(Cells(i, 3), 7)        '±NBarcode¦s¨ì [F5], ¨Ñ MATCH ¬d¸ß"Äæ"¥Î
  50.         [F2] = Right(Cells(i, 3), 6)       '±N³f¸¹¦s¨ì [E2], ¨Ñ MATCH ¬d¸ß"¦C"¥Î
  51.         '[F8] = ®w¦sªí¤¤ªº ®w¦s¶q
  52.         Cells(i, 5) = [F8] - Cells(i, 4)   '¦s¶q = ­ì®w¦s¶q - ¾P°â¶q
  53.         
  54.         '¦pªG ³f¸¹ ­«ÂÐ, ²Ä¤Gµ§¶}©l, «h
  55.         If Cells(i, 3) = Cells(i + 1, 3) Then
  56.             Do
  57.                 i = i + 1
  58.                 If Cells(i, 3) = "" Then GoTo done1:
  59.                 Cells(i, 5) = Cells(i - 1, 5) - Cells(i, 4)     '¦s¶q = ¤W¤@µ§¦s¶q - ¾P°â¶q
  60.             Loop Until i > Barcode¼Æ Or Cells(i, 3) <> Cells(i + 1, 3)
  61.         End If
  62.     Loop Until i > Barcode¼Æ
  63.    
  64. done1:
  65.     '6. «ö­ì§Ç±Æ§Ç
  66.         [A1].Resize(Barcode¼Æ + 1, 5).Sort _
  67.               Key1:=Range("A1"), Order1:=xlAscending, _
  68.               Header:=xlYes
  69. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : µoµÊ®ð¬Oµu¼ÈªºµoºÆ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD