用 vba 吧看著就頭大Sub ss() Dim i, j, l, mg Select Case [a16] Case Is <= 100: i = 3: j = 0 Case Is <= 500: i = 4: j = 100 Case Is <= 1000: i = 5: j = 500 Case Is <= 5000: i = 6: j = 1000 Case Is <= 10000: i = 7: j = 5000 Case Is <= 50000: i = 8: j = 10000 Case Is <= 100000: i = 9: j = 50000 Case Is <= 500000: i = 10: j = 100000 Case Is <= 1000000: i = 11: j = 500000 Case Is > 1000000: i = 12: j = 1000000 End Select If i = 3 Then [b16] = [a16] * [c4] Else mg = Range(Cells(i, 4), Cells(4, 4)) [b16] = ([a16] - j) * Cells(i + 1, 3) + WorksheetFunction.Sum(mg) End IfEnd Sub
用 vba 吧看著就頭大Sub ss() Dim i, j, l, mg Select Case [a16] Case Is <= 100: i = 3: j = 0 Case Is <= 500: i = 4: j = 100 Case Is <= 1000: i = 5: j = 500 Case Is <= 5000: i = 6: j = 1000 Case Is <= 10000: i = 7: j = 5000 Case Is <= 50000: i = 8: j = 10000 Case Is <= 100000: i = 9: j = 50000 Case Is <= 500000: i = 10: j = 100000 Case Is <= 1000000: i = 11: j = 500000 Case Is > 1000000: i = 12: j = 1000000 End Select If i = 3 Then [b16] = [a16] * [c4] Else mg = Range(Cells(i, 4), Cells(4, 4)) [b16] = ([a16] - j) * Cells(i + 1, 3) + WorksheetFunction.Sum(mg) End IfEnd Sub