ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] Åý¤½¦¡ªº­È,ª½±µ±a¤JÀx¦s®æ

¦^´_ 20# ­ã´£³¡ªL
Dear ­ã¤j,

¤£¦n·N«ä,§Ú¨S¦³ªí¹F©ú¥Õ,FÄæ¹JªÅ®æ®É,ªí¥Ü³o¬qµ{¦¡´Nµ²§ô¤F,
ªÅ¥Õ«áªº¬O¥t¤@¥÷¤å¥ó,©Ò¥H·|¦³¤£¦Pªºµ{¦¡±µÄò..

©Ò¥H§Ú·QÅýFÄæ¹JªÅ®æ®É,°±¤îRange("JQ4:JQ" & xRow).valueªº°Ê§@
½Ð°Ý»yªk¸Ó«ç»òªí¹F?
xRow = Cells(Cells.Rows.Count, "F").End(xlUp).Row
Range("JQ4:JQ" & xRow).value = "=AH4-BR4"

TOP

¦^´_ 20# ­ã´£³¡ªL

­ã¤j,
¦Ò¼{¨ìªí®æªº¯S©Ê,§Ú·Q§ïÅܤ@­Ó§@ªk,¦p¹Ï
¥HBÄæ®Æ¸¹¬°¨Ì¾Ú,CÄæ¬O½c¼Æ¡BDÄæ¬O²~¼Æ
§äCÄ檺"½c¼Æ"¦r¼Ë,¦b¤U¤@®æªÅ¥Õ³B,«h¥HBÄ欰¦C¼Æ·Ç«h,Key¤J¤½¦¡¡G=INT(F4/E4)
§äDÄæ¦r¼Ë"²~¼Æ"¦b¤U¤@®æªÅ¥Õ³B,¥HBÄ欰¦C¼Æ¬°·Ç«h,Key¤J¤½¦¡¡G=MOD(F4,E4)
·íBÄæ®Æ¸¹¬°ªÅ¥Õ®É,«h"½c¼Æ" & "²~¼Æ"ªº¤½¦¡´Nµ²§ô,
§_«hÄ~Äò§ä¤U¤@­Ó"½c¼Æ"¡B"²~¼Æ"Ä~ÄòKey¤J¤½¦¡,
¤@ª½¨ìC¡BDÄæ¥þ³¡ªº"½c¼Æ"¡B"²~¼Æ"³£¾ú¹M¬°¤î

TOP

¦^´_ 22# PJChen


¤W¶ÇÀɮצn°µ¨Æ~~

TOP

¦^´_ 23# ­ã´£³¡ªL
ªí³æ¬O¹ê»Úªº¨Ï¥Î®æ¦¡
~~~·PÁ­ã¤j~~~

²z³f³æ.rar (109.92 KB)

TOP

¨âºØ¤è®×, ¦Û¦æ¿ï¥Î:
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) = "¦X­p" Then
       Brr(i, 1) = S(1) '½c¼Æ¦X­p
       Brr(i, 2) = S(2) '²~¼Æ¦X­p
       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=""¦X­p"",SUM(M$1:M2)-SUMIF($K$1:$K2,""¦X­p"",M$1:M2)*2," & _
            "IF(($L3="""")+($P3=0),"""",IF(M$2=""½c¼Æ"",INT($Q3/$P3),MOD($Q3,$P3)))))"
     .Value = .Value
End With


'=============================================
End Sub

TOP

¦^´_ 25# ­ã´£³¡ªL
½Ð°Ý­ã¤j,

§Ú¦³¥t¤@®æ¦¡ªºªí®æ,¦P¼Ë°µªk,¥»·Q®M¥Î¦P¤@µ{¦¡,¤p¤p­×§ïÄæ¦ì§Y¥i,¦ý«oµLªk¨Ï¥Î,
½ÐÀ°¦£¬Ý¤U,¬O§_ÁÙ¦³»Ý­×§ïªº¦a¤è?
  1. Sub EX()
  2. Dim R&, Arr, Brr, i&, S&(1 To 2), V1, V2
  3. R = Cells(Rows.Count, "J").End(xlUp).Row
  4. If R <= 2 Then Exit Sub
  5. Arr = Range("J2:P" & R)
  6. Brr = Range("L2:M" & R)
  7. For i = 1 To UBound(Arr)
  8.     If Arr(i, 1) = "«~¦W" Then Erase S: GoTo 101
  9.     If Arr(i, 1) = "¦X­p" Then
  10.        Brr(i, 1) = S(1) '½c¼Æ¦X­p
  11.        Brr(i, 2) = S(2) '²~¼Æ¦X­p
  12.        Erase S: GoTo 101
  13.     End If
  14.     Brr(i, 1) = "":    Brr(i, 2) = ""
  15.     V1 = Val(Arr(i, 6)) '¥]¸Ë¼Æ
  16.     V2 = Val(Arr(i, 7)) '­qÁʼÆ
  17.     If Arr(i, 2) = "" Or V1 = 0 Then GoTo 101
  18.     Brr(i, 1) = Int(V2 / V1) '½c¼Æ
  19.     S(1) = S(1) + Brr(i, 1)  '½c¼Æ²Ö­p
  20.     Brr(i, 2) = V2 Mod V1  '²~¼Æ
  21.     S(2) = S(2) + Brr(i, 2) '²~¼Æ²Ö­p
  22. 101: Next i
  23. Range("L2:M" & R) = Brr
  24. End Sub
½Æ»s¥N½X
²z³f³æ_¥t¤@®æ¦¡.rar (91.42 KB)

TOP

¥»©«³Ì«á¥Ñ PJChen ©ó 2020-2-17 00:18 ½s¿è

¦^´_ 25# ­ã´£³¡ªL
Dear ­ã¤j,
´ú¸Õ¤F¾ã±ß,µo²{°ÝÃDÂI¨Ã¥B¸Ñ¨M¤F,¥i¥H©¿²¤§Úªº¤W­Ó¦^ÂÐ~~
§Úªºªí³æ·|¦]¬°«È¤á¦]¯À¦Ó¦³ÅܤÆ,²Ä¤@­Óµ{¦¡¥i¥H¤ñ¸û¬¡¥Î,§Ú¤ñ¸û³ßÅw
±zªº¥\¤O¯u¬OµL¼Ä¡I¡I
TEST_2ÁöµM«Üºë²,¦ý¦b´ú¸Õ®Éµo²{,ªí³æ¦³ÅÜ,¶K¤Wªº¸ê®Æ·|¥X¿ù

TOP

¥»©«³Ì«á¥Ñ PJChen ©ó 2020-2-18 00:02 ½s¿è

¦^´_ 25# ­ã´£³¡ªL
­ã¤j,

¤µ¤Ñ¦b§@·~¤¤µo²{,¦Û°Ê­pºâ½c²~«á,¥¦·|§âªí®æ¥~ªº¬Y¨Ç¤å¦r²M°£±¼,
§Ú§Æ±æªí®æ¥~ªº¥ô¦óÀx¦s®æ,³£¥i¥Hºû«ù­ì¨Óªº¼Ë¤l,³o­Ó³¡¥÷¯à§_§JªA?


²z³f³æ.rar (86.32 KB)

TOP

¦^´_ 28# PJChen

Sub TEST_1()
Dim R&, Arr, Brr, i&, S&(1 To 2), V1, V2, C%
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: C = 1: GoTo 101
    If Arr(i, 1) = "¦X­p" Then
       Brr(i, 1) = S(1) '½c¼Æ¦X­p
       Brr(i, 2) = S(2) '²~¼Æ¦X­p
       Erase S: C = 0: GoTo 101
    End If
    If C = 1 Then
       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
    End If
101: Next i
Range("M2:N" & R) = Brr
End Sub

'================================

TOP

¦^´_ 28# PJChen


Sub TEST_2()
Dim R&, xR As Range, xH As Range, C%
R = Cells(Rows.Count, "K").End(xlUp).Row
If R <= 2 Then Exit Sub
For Each xR In Range("K2:K" & R)
    If xR = "«~¦W" Then Set xH = xR(2, 3): C = 1: GoTo 101
    If xR = "¦X­p" Then
       If C = 0 Then GoTo 101
       With Range(xH, xR(0, 4))
            .Columns(1).FormulaR1C1 = "=IF(OR(RC[-1]="""",N(RC[3])=0),"""",INT(RC[4]/RC[3]))"
            .Columns(2).FormulaR1C1 = "=IF(OR(RC[-2]="""",N(RC[2])=0),"""",MOD(RC[3],RC[2]))"
            .Value = .Value
       End With
       xR(1, 3) = "=SUM(" & Range(xH(1, 1), xR(0, 3)).Address & ")" '½c¼Æ¦X­p¤½¦¡
       xR(1, 4) = "=SUM(" & Range(xH(1, 2), xR(0, 4)).Address & ")" '²~¼Æ¦X­p¤½¦¡
       xR(1, 7) = "=SUM(" & Range(xH(1, 5), xR(0, 7)).Address & ")" '­qÁÊ¼Æ ¦X­p¤½¦¡
       C = 0
    End If
101: Next
End Sub


'=================================

TOP

        ÀR«ä¦Û¦b : ¸Ü¦h¤£¦p¸Ü¤Ö¡A¸Ü¤Ö¤£¦p¸Ü¦n¡C
ªð¦^¦Cªí ¤W¤@¥DÃD