- ©«¤l
- 976
- ¥DÃD
- 7
- ºëµØ
- 0
- ¿n¤À
- 1018
- ÂI¦W
- 0
- §@·~¨t²Î
- Win10
- ³nÅ骩¥»
- Office 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2013-4-19
- ³Ì«áµn¿ý
- 2024-10-30
|
¦^´_ 5# john2006168
§ÚºÉ¤O¥[¤Jµù¸Ñ¡A¥i¯à¦³¨Ç¼g±o¤£¦n¤£¸Ô²Ó¡A½Ð±z¦Û¦æ¬ã¨s¤F¡AÁÂÁ¡C
Sub test1()
Dim Arr, xD, TT, T, T1, T2, T3, N%, i&
Set xD = CreateObject("Scripting.Dictionary")
Arr = [A1].CurrentRegion '¸ê®Æ©ñ¤J¼Æ²Õ
For i = 2 To UBound(Arr)
'T:EÄæ¸ê®Æ¡BT2:BÄæ¡BT3:CÄæ
T = Arr(i, 5): T2 = Arr(i, 2): T3 = Arr(i, 3)
If xD.Exists(T & "") Then '¦r¨å¦³µLEÄæ¸ê®Æ
If N = 0 Then
N = 1: TT = xD(T & "")(0) '«½Æ¥X²{ªº²Ä1¦¸¨Ì³W«h½s¸¹(²Ä2½X)
Else
TT = xD(T & "")(0) + T1 '«½Æ¥X²{ªº²Ä2¦¸¥H¤W¨Ì³W«h½s¸¹(²Ä2½X)
End If
Arr(i, 1) = Arr(i, 5) & TT & "1" & "-" & T & T3 + xD(T & "")(1) '¨Ì³W«h½s¸¹
xD(T & "") = Array(T2, T3 + xD(T & "")(1)) 'CÄæ(kg)²Ö¥[¸Ë¤J¦r¨å
Else
Arr(i, 1) = Arr(i, 5) & "1" & "-" & T & T3 '²Ä1¦¸¥X²{¡A¨Ì³W«h½s¸¹©ñ¤JArr
xD(T & "") = Array(T2, T3): N = 0: T1 = xD(T & "")(0) 'B,CÄæ¸ê®Æ©ñ¤J¦r¨å¡AT1³]¬°BÄæ²Ä¤@¦¸¥X²{¼ÆÈ¡AN=0Âk¹s(P-C)
End If
Next
Arr(1, 1) = "Carton"
Range("d1").Resize(UBound(Arr), 1) = Arr
End Sub |
|