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
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。