I am trying to write my first VBA code in many many years. What I am attempting to do is have the dollar amount in column A multiplied by a preset drop down (term lengths) in column B and the sum of the dollar amount multiplied by the % equal to the drop down menu (I hope that makes sense).
Example (sorry for the lines, I couldn't figure out the spacing):
A_______B_________C
$300____M2M_____$30.00
$450_____24______$292.50
Seems pretty simple but things I can't figure out :
1) Why my code isn't working
2) How to have this automatically work. Meaning when I put a dollar amount into Column A and select column B, for Column C to populate
Sub Term_Calc()
If ActiveCell.Offset(0, -1) = "M2M" Then Sum ((ActiveCell.Offset(0, -2) * 0.1))
ElseIf ActiveCell.Offset(0, -1) = "12" Then Sum ((ActiveCell.Offset(0, -2) * 0.5))
ElseIf ActiveCell.Offset(0, -1) = "24" Then Sum ((ActiveCell.Offset(0, -2) * 0.65))
ElseIf ActiveCell.Offset(0, -1) = "36" Then Sum ((ActiveCell.Offset(0, -2) * 0.9))
ElseIf ActiveCell.Offset(0, -1) = "48" Then Sum ((ActiveCell.Offset(0, -2) * 1.1))
ElseIf ActiveCell.Offset(0, -1) = "60" Then Sum ((ActiveCell.Offset(0, -2) * 1.25))
ElseIf ActiveCell.Offset(0, -1) = "72" Then Sum ((ActiveCell.Offset(0, -2) * 1.3))
Else: Sum ((ActiveCell.Offset(0, -2) * 1.35))
End Sub
Any help would be appreciated.
Thanks!
Example (sorry for the lines, I couldn't figure out the spacing):
A_______B_________C
$300____M2M_____$30.00
$450_____24______$292.50
Seems pretty simple but things I can't figure out :
1) Why my code isn't working
2) How to have this automatically work. Meaning when I put a dollar amount into Column A and select column B, for Column C to populate
Sub Term_Calc()
If ActiveCell.Offset(0, -1) = "M2M" Then Sum ((ActiveCell.Offset(0, -2) * 0.1))
ElseIf ActiveCell.Offset(0, -1) = "12" Then Sum ((ActiveCell.Offset(0, -2) * 0.5))
ElseIf ActiveCell.Offset(0, -1) = "24" Then Sum ((ActiveCell.Offset(0, -2) * 0.65))
ElseIf ActiveCell.Offset(0, -1) = "36" Then Sum ((ActiveCell.Offset(0, -2) * 0.9))
ElseIf ActiveCell.Offset(0, -1) = "48" Then Sum ((ActiveCell.Offset(0, -2) * 1.1))
ElseIf ActiveCell.Offset(0, -1) = "60" Then Sum ((ActiveCell.Offset(0, -2) * 1.25))
ElseIf ActiveCell.Offset(0, -1) = "72" Then Sum ((ActiveCell.Offset(0, -2) * 1.3))
Else: Sum ((ActiveCell.Offset(0, -2) * 1.35))
End Sub
Any help would be appreciated.
Thanks!