- ©«¤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
|
¨âºØ¤è®×, ¦Û¦æ¿ï¥Î:
Sub TEST_1()
Dim R&, Arr, Brr, i&, S&(1 To 2), V1, V2
R = Cells(Rows.Count, "K").End(xlUp).Row
If R <= 2 Then Exit Sub
Arr = Range("K2:Q" & R)
Brr = Range("M2:N" & R)
For i = 1 To UBound(Arr)
If Arr(i, 1) = "«~¦W" Then Erase S: GoTo 101
If Arr(i, 1) = "¦Xp" Then
Brr(i, 1) = S(1) '½c¼Æ¦Xp
Brr(i, 2) = S(2) '²~¼Æ¦Xp
Erase S: GoTo 101
End If
Brr(i, 1) = "": Brr(i, 2) = ""
V1 = Val(Arr(i, 6)) '¥]¸Ë¼Æ
V2 = Val(Arr(i, 7)) 'qÁʼÆ
If Arr(i, 2) = "" Or V1 = 0 Then GoTo 101
Brr(i, 1) = Int(V2 / V1) '½c¼Æ
S(1) = S(1) + Brr(i, 1) '½c¼Æ²Öp
Brr(i, 2) = V2 Mod V1 '²~¼Æ
S(2) = S(2) + Brr(i, 2) '²~¼Æ²Öp
101: Next i
Range("M2:N" & R) = Brr
End Sub
'============================================
Sub TEST_2()
Dim R&
R = Cells(Rows.Count, "K").End(xlUp).Row
If R <= 2 Then Exit Sub
With Range("M3:N" & R)
.Formula = "=IF($K3=$K$2,M$2,IF($K3=""¦Xp"",SUM(M$1:M2)-SUMIF($K$1:$K2,""¦Xp"",M$1:M2)*2," & _
"IF(($L3="""")+($P3=0),"""",IF(M$2=""½c¼Æ"",INT($Q3/$P3),MOD($Q3,$P3)))))"
.Value = .Value
End With
'=============================================
End Sub |
|