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

[µo°Ý] ¨D§U~±Æµ{¶ñ¤J¤é´Á

¦^´_ 1# adam2010


    ¸Õ¸Õ¬Ý§a
  1. Private Sub CommandButton1_Click()

  2. Dim LotID As Range, Tagt As Range, Qty As Range
  3. Dim a, TalQty

  4. With sheet2

  5.     For Each LotID In .Range("A2:A" & .[A65536].End(xlUp).Row)
  6.    
  7.         For Each Tagt In .Range("B" & LotID.Row & ":J" & LotID.Row)
  8.         
  9.             If Tagt <> "" Then
  10.         
  11.                 With Sheet1
  12.             
  13.                     a = Application.Match(LotID, .[A:A], 0)
  14.                     aa = Application.CountIf(.[A:A], LotID)
  15.                     TalQty = 0
  16.         
  17.                     For Each Qty In .Range("D" & a & ":D" & (a + aa - 1))
  18.             
  19.                         If Qty.Offset(, 1) <> "" Then GoTo ntxa
  20.                
  21.                         Qty = Qty + TalQty
  22.                
  23.                         If Qty < Tagt Then
  24.                         
  25.                             Qty.Offset(, 1) = sheet2.Cells(1, Tagt.Column)
  26.                             TalQty = Qty
  27.                         
  28.                         Else
  29.                            
  30.                             Qty.Offset(, 1) = sheet2.Cells(1, Tagt.Column)
  31.                             GoTo ntla
  32.                         End If
  33. ntxa:
  34.                     Next Qty
  35. ntla:
  36.                 End With
  37.             End If
  38.             
  39.         Next Tagt
  40.    
  41.     Next LotID

  42. End With
  43.    
  44. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¡i¥Í©R¦b©I§l¶¡¡j¦òªû»¡¡G¡u¥Í©R¦b©I§l¶¡¡C¡v¤HµLªkºÞ¦í¦Û¤vªº¥Í©R¡A§óµLªk¾×¦í¦º´Á¡AÅý¦Û¤v¥Ã¦í¤H¶¡¡C¬JµM¥Í©R¥h¨Ó³o»òµL±`¡A§Ú­Ì§óÀ³¸Ó¦n¦n¦a·R±¤¥¦¡B§Q¥Î¥¦¡B¥R¹ê¥¦¡AÅý³oµL±`¡BÄ_¶Qªº¥Í©R¡A´²µo¥¦¯uµ½¬üªº¥ú½÷¡A¬M·Ó¥X¥Í©R¯u¥¿ªº»ù­È¡C
ªð¦^¦Cªí ¤W¤@¥DÃD