- ©«¤l
- 2834
- ¥DÃD
- 10
- ºëµØ
- 0
- ¿n¤À
- 2890
- ÂI¦W
- 0
- §@·~¨t²Î
- ¡e²¤¡f
- ³nÅ骩¥»
- ¡e²¤¡f
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¡e²¤¡f
- µù¥U®É¶¡
- 2013-5-13
- ³Ì«áµn¿ý
- 2024-11-23
|
¦^´_ 5# john2006168
¤£²M¤£·¡, éµÛ¼g:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim xF As Range, Cr, DNo1&, dNo2&, xE As Range
With Target
If .Address <> "$A$2" Then Exit Sub
If .Value = "" Then Exit Sub
Set xF = [F:F].Find(.Value, Lookat:=xlWhole, SearchDirection:=xlPrevious) '¨ú±o³Ì«á¤@µ§ shipment ref
If Not xF Is Nothing Then DNo1 = Val(xF(1, -3)) + 1 '±o³Ì«á¤@µ§ shipment ref ªº batch no +1
Set xF = [Data!H:H].Find(.Value, Lookat:=xlWhole)
If xF Is Nothing Then Exit Sub
Application.EnableEvents = False
Cr = Array(9, 2, 9, 8, 6, 7, 1, 16, 17, 18, 19, 20, 21)
Set xE = Cells(Rows.Count, 3).End(xlUp)(2)
If xE.Row < 5 Then Set xE = [C5]
For j = 1 To 13
xE(1, j) = Sheets("Data").Cells(xF.Row, Cr(j - 1)).Value
Next j
If Not IsDate(xE(1, 2)) Then Exit Sub
dNo2 = Format(xE(1, 2), "yymm") * 1000 + 1
xE(1, 0) = Application.Max(DNo1, dNo2)
Application.EnableEvents = True
End With
End Sub
Xl0000285.rar (24.04 KB)
|
|