w 算法优化
Cells(i, "Y") + Cells(i, "Z") * 0.2 多计算了一次
是 1*SUM(i)次
Sub 订单利润() Dim Adjustment, FBA_W_Fee, W_Deal_Fee, Order, Refund, Service_Fee, Transfer As Integer, i As Integer i = 2 Do Select Case Cells(i, "C") Case Is = Adjustment Cells(i, "AA") = 0 Case Is = FBA_W_Fee And W_Deal_Fee And Service_Fee Cells(i, "AA") = Range(Cells(i, "V")) Case Is = Order If Cells(i, "X") = "" Then Cells(i, "AA") = 0 Else Cells(i, "AA") = Range(Cells(i, "Z")) - Range(Cells(i, "Y")) * Range(Cells(i, "G")) End If Case Is = Refund If (Range(Cells(i, "Y")) + Range(Cells(i, "Z"))) * 0.1234 < 0 Then Cells(i, "AA") = (Range(Cells(i, "Y")) + Range(Cells(i, "Z"))) * 0.1234 Else Cells(i, "AA") = 0 End If Case Is = Transfer Cells(i, "AA") = 0 End Select i = i + 1 Loop Until Cells(i, "C") = "" End Sub Sub 订单利润0() Dim Adjustment, FBA_W_Fee, W_Deal_Fee, Order, Refund, Service_Fee, Transfer As Integer, i As Integer i = 2 Do Cells(i, "AA") = 1000 i = i + 1 Loop Until Cells(i, "C") = "" End Sub Sub 订单利润1() Dim Adjustment, FBA_W_Fee, W_Deal_Fee, Order, Refund, Service_Fee, Transfer As Integer, i As Integer i = 2 Do Select Case Cells(i, "C") Case Is = "Adjustment" Cells(i, "AA") = 12 End Select i = i + 1 Loop Until Cells(i, "C") = "" End Sub Sub 订单利润2() Dim Adjustment, FBA_W_Fee, W_Deal_Fee, Order, Refund, Service_Fee, Transfer As Integer, i As Integer i = 2 Do Cells(i, "AA") = 0 Select Case Cells(i, "C") Case Is = "Adjustment" Cells(i, "AA") = 12 End Select i = i + 1 Loop Until Cells(i, "C") = "" End Sub Sub 订单利润3() Dim Adjustment, FBA_W_Fee, W_Deal_Fee, Order, Refund, Service_Fee, Transfer As Integer, i As Integer i = 2 Do Cells(i, "AA") = 0 Select Case Cells(i, "C") Case Is = "Adjustment" Cells(i, "AA") = 12 End Select i = i + 1 Loop Until Cells(i, "C") = "" End Sub Sub 订单利润4() Dim Adjustment, FBA_W_Fee, W_Deal_Fee, Order, Refund, Service_Fee, Transfer As Integer, i As Integer i = 2 Do Cells(i, "AA") = 0 Select Case Cells(i, "C") Case Is = "Adjustment" Cells(i, "AA") = Cells(i, "V") End Select i = i + 1 Loop Until Cells(i, "C") = "" End Sub Sub 订单利润5() Dim Adjustment, FBA_W_Fee, W_Deal_Fee, Order, Refund, Service_Fee, Transfer As Integer, i As Integer i = 2 Do Cells(i, "AA") = 0 Select Case Cells(i, "C") Case Is = "FBA Inventory Fee" Cells(i, "AA") = Cells(i, "V") End Select i = i + 1 Loop Until Cells(i, "C") = "" End Sub Sub 订单利润6() Dim Adjustment, FBA_W_Fee, W_Deal_Fee, Order, Refund, Service_Fee, Transfer As Integer, i As Integer i = 2 Do Cells(i, "AA") = 0 Select Case Cells(i, "C") Case Is = "FBA Inventory Fee" Cells(i, "AA") = Cells(i, "V") Case Is = "W Deal Fee" Cells(i, "AA") = Cells(i, "V") Case Is = "Service Fee" Cells(i, "AA") = Cells(i, "V") End Select i = i + 1 Loop Until Cells(i, "C") = "" End Sub Sub 订单利润7() Dim Adjustment, FBA_W_Fee, W_Deal_Fee, Order, Refund, Service_Fee, Transfer As Integer, i As Integer i = 2 Do Cells(i, "AA") = 0 Select Case Cells(i, "C") Case Is = "FBA Inventory Fee" Cells(i, "AA") = Cells(i, "V") Case Is = "W Deal Fee" Cells(i, "AA") = Cells(i, "V") Case Is = "Service Fee" Cells(i, "AA") = Cells(i, "V") Case Is = "Order" If Not IsError(Cells(i, "X")) Then Cells(i, "AA") = Cells(i, "Z") - Cells(i, "Y") * Cells(i, "G") End If Case Is = "Refund" If Cells(i, "Y") + Cells(i, "Z") * 0.1234 < 0 Then Cells(i, "AA") = Cells(i, "Y") + Cells(i, "Z") * 0.1234 End If End Select i = i + 1 Loop Until Cells(i, "C") = "" End Sub Sub 订单利润8() Dim Adjustment, FBA_W_Fee, W_Deal_Fee, Order, Refund, Service_Fee, Transfer As Integer, i As Integer i = 2 Do Cells(i, "AA") = 0 Select Case Cells(i, "C") Case Is = "FBA Inventory Fee", "W Deal Fee", "Service Fee" Cells(i, "AA") = Cells(i, "V") Case Is = "Order" If Not IsError(Cells(i, "X")) Then Cells(i, "AA") = Cells(i, "Z") - Cells(i, "Y") * Cells(i, "G") End If Case Is = "Refund" If Cells(i, "Y") + Cells(i, "Z") * 0.1234 < 0 Then Cells(i, "AA") = Cells(i, "Y") + Cells(i, "Z") * 0.1234 End If End Select i = i + 1 Loop Until Cells(i, "C") = "" End Sub Sub 订单利润9() Dim i As Integer i = 2 Do Cells(i, "AA") = 0 Select Case Cells(i, "C") Case Is = "FBA Inventory Fee", "W Deal Fee", "Service Fee" Cells(i, "AA") = Cells(i, "V") Case Is = "Order" If Not IsError(Cells(i, "X")) Then Cells(i, "AA") = Cells(i, "Z") - Cells(i, "Y") * Cells(i, "G") End If Case Is = "Refund" If Cells(i, "Y") + Cells(i, "Z") * 0.1234 < 0 Then Cells(i, "AA") = Cells(i, "Y") + Cells(i, "Z") * 0.1234 End If End Select i = i + 1 Loop Until Cells(i, "C") = "" End Sub