SkzDaLimit
Board Regular
- Joined
- Dec 1, 2002
- Messages
- 54
Another quick mystery to solve. I tried modifying a macro from a previous spreadsheet you all helped me on to try and make this work.
G23 contains the total amount of money received for an item.
I23 is a drop down with 3 different payment options: PayPal, Amazon Payment and Google Checkout.
PayPal and Google use the same formula to compute the final fee in J23: =IF($G23>0,$G23*2.9%+0.3)
Amazon uses a 2 tier system thus the formula: =IF($G23>10,$G23*2.9%+0.3,IF($G23<=10,$G23*5%+0.05))
This is the macro I came up with:
Private Sub Worksheet_Change(ByVal Target As Range)
' Michael Alan Johnson, 10/04/2011
If Intersect(Target, Range("I23:I1000")) Is Nothing Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target = "" Then Range("J" & Target.Row) = 0
With Application
.EnableEvents = False
.ScreenUpdating = False
Select Case Target.Value
Case "PayPal"
'=IF($G23>0,$G23*2.9%+0.3)
'=IF(G23>0,G23*2.9%+0.3)
Range("J" & Target.Row).FormulaR1C1 = "=IF($G23>0,$G23*2.9%+0.3)"
Case "Amazon Payment"
'=IF($G23>10,$G23*2.9%+0.3,IF($G23<=10,$G23*5%+0.05))
'=IF(G23>10,G23*2.9%+0.3,IF(G23<=10,G23*5%+0.05))
Range("J" & Target.Row).FormulaR1C1 = "=IF($G23>10,$G23*2.9%+0.3,IF($G23<=10,$G23*5%+0.05))"
Case "Google Checkout"
'=IF($G23>0,$G23*2.9%+0.3)
'=IF(G23>0,G23*2.9%+0.3)
Range("J" & Target.Row).FormulaR1C1 = "=IF($G23>0,$G23*2.9%+0.3)"
End Select
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub
Can't seem to get it to work.......
Excel 2003
G23 contains the total amount of money received for an item.
I23 is a drop down with 3 different payment options: PayPal, Amazon Payment and Google Checkout.
PayPal and Google use the same formula to compute the final fee in J23: =IF($G23>0,$G23*2.9%+0.3)
Amazon uses a 2 tier system thus the formula: =IF($G23>10,$G23*2.9%+0.3,IF($G23<=10,$G23*5%+0.05))
This is the macro I came up with:
Private Sub Worksheet_Change(ByVal Target As Range)
' Michael Alan Johnson, 10/04/2011
If Intersect(Target, Range("I23:I1000")) Is Nothing Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target = "" Then Range("J" & Target.Row) = 0
With Application
.EnableEvents = False
.ScreenUpdating = False
Select Case Target.Value
Case "PayPal"
'=IF($G23>0,$G23*2.9%+0.3)
'=IF(G23>0,G23*2.9%+0.3)
Range("J" & Target.Row).FormulaR1C1 = "=IF($G23>0,$G23*2.9%+0.3)"
Case "Amazon Payment"
'=IF($G23>10,$G23*2.9%+0.3,IF($G23<=10,$G23*5%+0.05))
'=IF(G23>10,G23*2.9%+0.3,IF(G23<=10,G23*5%+0.05))
Range("J" & Target.Row).FormulaR1C1 = "=IF($G23>10,$G23*2.9%+0.3,IF($G23<=10,$G23*5%+0.05))"
Case "Google Checkout"
'=IF($G23>0,$G23*2.9%+0.3)
'=IF(G23>0,G23*2.9%+0.3)
Range("J" & Target.Row).FormulaR1C1 = "=IF($G23>0,$G23*2.9%+0.3)"
End Select
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub
Can't seem to get it to work.......
Excel Workbook | |||||
---|---|---|---|---|---|
G | I | J | |||
21 | Total Received | Checkout Method | Checkout Fee | ||
22 | |||||
23 | $12.00 | ||||
... |