- ©«¤l
- 835
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 915
- ÂI¦W
- 16
- §@·~¨t²Î
- Win 10,7
- ³nÅ骩¥»
- 2019,2013,2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-3
- ³Ì«áµn¿ý
- 2024-11-14
|
¥»©«³Ì«á¥Ñ luhpro ©ó 2019-3-2 07:29 ½s¿è
¦³¨Çn§ä¦Ñ®v©M°ª¤âÀ°¦£, ¸U¤À·P¿E.
§Ú¥®É·|¦bsheets"checking"ªºA2¥Î scaner±½ºË¤å¥ó¤Wªºbar code¸¹ ...
john2006168 µoªí©ó 2019-3-1 09:45
©êºp,¤£¬O¬Ý±o«ÜÀ´§Aªº·N«ä,¥u¯à¥H¦Û¤vªº²z¸Ñ¨Ó¹ê§@¤F.
¦b¦¹°²³]§A¬On¦b¿é¤JBarcode®É,
¦Û°Ê¦bData¤¤¥HSHIPMENT REFÄæ¦ì¬°ÁäÈ,
§ä¨ì¬ÛÃö¸ê®Æ±a¤Jshipment record¤º,
¨º»òµ{¦¡¥i¥H³o¼Ë¼g :(©³¤U===¤¤¬Oµ{¦¡©Ò©ñªº¦a¤è)
º¥ý,±NDataªº¸ê®Æ«Ø¥ß¯Á¤Þ¥H¤è«K¤§«á§ì¨ú,
³o¸Ì¦³ÓDictionary¨ç¼Æº¡¦n¥Îªº,
¥¦¥i¥Hª½±µ«Ø¥ß¬ÛÃö¯Á¤Þ.
¥t¥~,¬°¤F¤è«K«áÄò¨ú¥Î,
¤]±N©w¸q¤TÓ¤u§@ªí.
¦]¬°³£n¦b¤£¦PªºSheet¤¤¤]¯à¨Ï¥Î,
©Ò¥Hn¦b¼Ò²Õ¤¤¨Ï¥ÎPublic¨Ó©w¸q
===Module1===- Public dShi
- Public shDat As Worksheet, shChk As Worksheet, shShr As Worksheet
½Æ»s¥N½X ¨ä¦¸,n¦bµ{¦¡¤@°õ¦æ´N¥ý±NDataªº¸ê®Æ«Ø¥ß¯Á¤Þ¥H¤è«K¤§«á§ì¨ú,
©Ò¥Hn©ñ¦b Workbook_Open ¸Ì.
===ThisWorkBook ªº Workbook_Open===- Dim lRow&, lRows&
-
- Set shDat = Sheets("Data")
- Set shChk = Sheets("Checking")
- Set shShr = Sheets("shipment record")
-
- Set dShi = CreateObject("Scripting.Dictionary")
-
- With shDat
- lRows = .Cells(Rows.Count, 1).End(xlUp).Row
- For lRow = 2 To lRows
- dShi(CStr(.Cells(lRow, 8))) = lRow
- Next
- End With
½Æ»s¥N½X (ÃD¥~¸Ü)³o¸Ì§Ô¤£¦í¤Sn¦AÁ¿¤@¦¸,
«Ø¥ß Dictionary ªº¨ç¼Æ½d¨Ò¤¤,
Scripting.Dictionary ±q¤@¶}©l´N§Ñ¤F¥[Âù¤Þ¸¹,
¤@ª½¨ì²{¦b¤´µMÁÙ¬O¨S¥[...ʨ
è¶}©l¾Ç²ß®É§Ú¦b³o¸Ì®À§é¹L,
¨S·Q¨ì´«³o»ò¦hª©¥»¤FÁÙ¬O¨SÅÜ,
¬Ý¨Ó·L³n¬O¥´ºâ¿ù¨ì©³¤F.
±µµÛ,¦pªGData¦³·s¼W¸ê®Æ¤]n§Y®É¥[¤JDictionary¸Ì¥H¤è«K«áÄò¨Ï¥Î.
===Data ªº Worksheet_Change===- With Target
- If .Column = 8 Then
- dShi(.Text) = .Row
- ' ¦pªG²M±¼ SHIPMENT REF n§R°£¾ã¦C¸ê®Æ
- Application.EnableEvents = False ' Åܧó¸ê®Æ¤¤,Ãö³¬Ä²µoChangeµ{§Ç
- If .Text = "" Then Rows(.Row).Delete
- Application.EnableEvents = True ' ¸ê®ÆÅܧ󧹲¦,«ì´_¥iIJµoChangeµ{§Ç
- End If
- End With
½Æ»s¥N½X ¦A¨Ó,n°O¿ýChecking¸ê®Æ³Ì¥½¦C,
¥H«K«áÄò²K¥[¸ê®Æ.
===Module1======ThisWorkBook ªº Workbook_Open===- lShrRow = shShr.Cells(Rows.Count, 1).End(xlUp).Row
½Æ»s¥N½X «e¸m§@·~§¹²¦,±µµÛ´N¬O«ÀYÀ¸¤F.
===Checking ªº Worksheet_Change===- Dim rTar As Range ' ¶ñ¸ê®Æ¼ÐªºÀx¦s®æAÄæ
-
- With Target
- If .Address = "$A$2" Then
- lRow = dShi(.Text)
- Application.EnableEvents = False ' Åܧó¸ê®Æ¤¤,Ãö³¬Ä²µoChangeµ{§Ç
- .Offset(, 1) = shDat.Cells(lRow, 1) ' B2
- .Offset(, 2) = shDat.Cells(lRow, 6) ' C2
- ' ¨ä¾l½Ð¦Û¦æ½Õ¾ã¶ñ¤J
-
- lShrRow = lShrRow + 1
- Set rTar = shShr.Cells(lShrRow, 1) ' [A¥½µ§Äæ¼Æ]
- With rTar
- .Offset(-1).Resize(, Columns.Count - 1).Copy ' ½Æ»s¤W¤@¦æªºÀx¦s®æ
- .PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone ' ¶K¤W®æ¦¡
- .Value = Date ' ¤µ¤Ñ¤é´Á-AÄæ
- End With
- rTar.Offset(, 19) = .Offset(, 0) 'TÄæ
- rTar.Offset(, 17) = .Offset(, 1) 'RÄæ
- rTar.Offset(, 14) = .Offset(, 2) 'OÄæ
- ' ¨ä¾l½Ð¦Û¦æ½Õ¾ã¶ñ¤J
-
- .Resize(, Columns.Count - 1).Clear ' ²M±¼¿é¤J°Ï¾ã¦æ¸ê®Æµ¥«Ý¿é¤J¤U¤@µ§
- Application.EnableEvents = True ' ¸ê®ÆÅܧ󧹲¦,«ì´_¥iIJµoChangeµ{§Ç
- End If
- End With
½Æ»s¥N½X ·íµMÁÙ¦³§ïµ½ªºªÅ¶¡,
¨º´Nn¾a§A¦Û¤v§V¤O¤F.
test abc recv - ANS.zip (58.82 KB)
|
|