Phantom645
New member
- Joined
- Nov 14, 2011
- Messages
- 3
- Reaction score
- 0
- Points
- 0
Hello everyone,
I'm a newbie so please be gentle!
I want Excel to automatically apply a formula to the cell that the user has just entered data into.
I am trying to learn VBA over the internet with limited success.
Code I have been playing with that has been working fine so far is:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("L7:L10")) Is Nothing Then
Application.EnableEvents = False
Target = Target * 2
Application.EnableEvents = True
End If
End Sub
I have been using the above to get me to a point where I can automatically manipulate the user entry data. But I need the formula of “Target * 2” above to actually be “SUM(Round(“Target”/$E$7,0)*$E$7)”
In other words, divide the Target by Cell "E7", Round the result to zero decimal places, and then multiply the new result by Cell "E7".
My problem is I do not know the code. Can anyone help me please?
Thanks a million team.
Regards,
Paul
I'm a newbie so please be gentle!
I want Excel to automatically apply a formula to the cell that the user has just entered data into.
I am trying to learn VBA over the internet with limited success.
Code I have been playing with that has been working fine so far is:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("L7:L10")) Is Nothing Then
Application.EnableEvents = False
Target = Target * 2
Application.EnableEvents = True
End If
End Sub
I have been using the above to get me to a point where I can automatically manipulate the user entry data. But I need the formula of “Target * 2” above to actually be “SUM(Round(“Target”/$E$7,0)*$E$7)”
In other words, divide the Target by Cell "E7", Round the result to zero decimal places, and then multiply the new result by Cell "E7".
My problem is I do not know the code. Can anyone help me please?
Thanks a million team.
Regards,
Paul