- ©«¤l
- 1446
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1470
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-10-21
|
¦^´_ 15# cypd
ÁÂÁ«e½ú¦^´_
«á¾Ç¾Ç²ß¤è®×¦p¤U,½Ð«e½ú°Ñ¦Ò
°õ¦æµ²ªG:
Sub TEST()
Dim Brr, V4&, V5&, Z, i&, T$, A&, Af&, B$, Bn&, D&, Df, Ra As Range
Set Z = CreateObject("Scripting.Dictionary")
Set Ra = Range([¤u§@ªí1!H3], [¤u§@ªí1!A65536].End(3)): Brr = Ra
For i = 1 To UBound(Brr)
T = Brr(i, 3): V4 = Val(Brr(i, 4)): V5 = Val(Brr(i, 5))
If V4 > 0 Then
A = Z(T & "|¶i"): A = A + V4: Z(T & "|¶i") = A
Af = Z(T & "|¶iÃB"): Af = Af + V4 * Val(Brr(i, 6))
Z(T & "|¶iÃB") = Af
End If
Bn = Val(Brr(i, 8))
If Bn > 0 Then
B = Z(T & "|ÃرÔ")
Z(T & "|ÃؼÆ") = Z(T & "|ÃؼÆ") + Bn
If B = "" Then
B = Brr(i, 1) & "¶µ_" & Brr(i, 2) & "_ÃØ_" & Bn
Else
B = B & " ¡¹" & Brr(i, 1) & "¶µ_" & Brr(i, 2) & "_ÃØ_" & Bn
End If
Z(T & "|ÃرÔ") = B: B = ""
End If
If V5 > 0 Then
D = Z(T & "|¾P"): D = D + V5: Z(T & "|¾P") = D
Df = Z(T & "|¾PÃB"): Df = Df + V5 * Val(Brr(i, 6))
Z(T & "|¾PÃB") = Df
End If
Next
Set Ra = Range([¤u§@ªí1!V2], [¤u§@ªí1!N65536].End(3)): Brr = Ra
For i = 2 To UBound(Brr)
T = Brr(i, 1)
Brr(i, 2) = Z(T & "|¶i")
Brr(i, 3) = Z(T & "|¾P") + Z(T & "|ÃؼÆ")
Brr(i, 4) = Brr(i, 2) - Brr(i, 3)
Brr(i, 5) = Z(T & "|¶iÃB")
Brr(i, 6) = Z(T & "|¾PÃB")
Brr(i, 7) = Brr(i, 6) - Brr(i, 5)
Brr(i, 8) = "¦@ÃØ¥X: " & Z(T & "|ÃؼÆ")
Brr(i, 9) = Z(T & "|ÃرÔ")
Next
Ra = Brr: [U2] = "³Æµù"
Set Z = Nothing: Erase Brr: Set Ra = Nothing
End Sub |
|