Reputation: 47
Can I make the value that I input automatically on a cell multiplied by a value on a cell? In the picture below, when I type "1" on "Jan" and press enter, the value automatically turns to "1500" by multiplying "Jan" with "Price". If I enter "3" on "Jan", then it becomes "4500"
Thank you!
Upvotes: 0
Views: 124
Reputation: 11988
To be honest, I think using a secondary column would be the best, but anyways, you can create an UDF in VBA to get this. I choose this approach instead of playing with events because using events sometimes give headaches managing them.
So my UDF is named PRICE but you can change it to something sorter and it requirres just the input number (1 or 3 in your example):
Public Function PRICE(ByVal vValue As Integer) As Double
PRICE = vValue * Application.ThisCell.Offset(0, -1).Value
End Function
This UDF will take always the previous cell in same row and will multiply by your input (1 or 3 or whatever)
Upvotes: 1