- ©«¤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
|
¦^´_ 1# cypd
½Ð´ú¸Õ¬Ý¬Ý¡AÁÂÁÂ
Sub test()
Dim Arr, xD, Brr, T, T1, TT$, ck%, ck1%, i&
Set xD = CreateObject("Scripting.Dictionary")
With Range([D2], [B65536].End(3))
Brr = .Value
.Sort Key1:=.Item(1), Order1:=1, Header:=1
Arr = .Value
For i = 2 To UBound(Arr)
TT = Arr(i, 1) & "|" & Arr(i, 2)
If Arr(i, 1) = 100 Then
If ck = 0 Then
T = 64565
Arr(i, 3) = "A00" & T & "-" & Format(T + Arr(i, 2) - 1, "A0000000")
ck = 1: T1 = T + Arr(i, 2): xD(TT) = Arr(i, 3)
Else
Arr(i, 3) = "A00" & T1 & "-" & Format(T1 + Arr(i, 2) - 1, "A0000000")
T1 = T1 + Arr(i, 2): xD(TT) = Arr(i, 3)
End If
ElseIf Arr(i, 1) = 500 Then
If ck1 = 0 Then
T = 81141
Arr(i, 3) = "B00" & T & "-" & Format(T + Arr(i, 2) - 1, "B0000000")
ck1 = 1: T1 = T + Arr(i, 2): xD(TT) = Arr(i, 3)
Else
Arr(i, 3) = "B00" & T1 & "-" & Format(T1 + Arr(i, 2) - 1, "B0000000")
T1 = T1 + Arr(i, 2): xD(TT) = Arr(i, 3)
End If
End If
Next
For i = 2 To UBound(Brr): TT = Brr(i, 1) & "|" & Brr(i, 2): Brr(i, 3) = xD(TT): Next
.Value = Brr
End With
End Sub |
|