1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| Dim number_of_session As Single
Dim cash_in As Single
Dim profit_or_loss As Single
Dim account_balance As Single
Dim cash_out As Single
Dim end_session_profit_or_loss_before_tax As Single
Dim tax_percentage As Single
tax_percentage = 30
Dim end_session_profit_or_loss_after_tax As Single
Dim i As Integer
i = 1
Dim irow As Single
Do While i >= number_of_session
Cells(1, 8) = i
i = i + 1
irow = Range("A" & Rows.Count).End(xlUp).Row + 1
number_of_session = InputBox("How many sessions did you trade?")
Range("A2").Value = number_of_session
cash_in = InputBox("How many cash-in?")
Range("B2").Value = cash_in
profit_or_loss = InputBox("How many profit or loss?")
Range("C2").Value = profit_or_loss
account_balance = cash_in + profit_or_loss
Range("D2").Value = account_balance
cash_out = InputBox("How many cash out?")
Range("E2").Value = cash_out
end_session_profit_or_loss_before_tax = cash_out - (cash_in * (cash_out / account_balance))
Range("F2").Value = end_session_profit_or_loss_before_tax
end_session_profit_or_loss_after_tax = (tax_percentage / 100) * end_session_profit_or_loss_before_tax
Range("G2").Value = end_session_profit_or_loss_after_tax
Loop
End Sub |