I need help in my project

Closed
Posts
1
Registration date
Saturday July 6, 2013
Status
Member
Last seen
July 6, 2013
-
Posts
2848
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
January 25, 2022
-
first see this picture
http://img713.imageshack.us/img713/6725/d9i8.png

now what i want is, after typing the '2' in B2, i press Enter, D2 will be added by B2 wich is '2' in this case so it will be 7, and B2 will be 0 as default, i dnt know if this is even possible but if someone can help i will be greatful :) thanks in advance.

1 reply

Posts
2848
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
January 25, 2022
491
Hi Smarty,

If you right-click your sheets tab and paste the following code in the big white field, The number entered in B2 will automatically be added to D2 and the value in B2 will be reset to 0:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B2")) Is Nothing Then Exit Sub
Range("D2").Value = Range("D2").Value + Range("B2").Value
Range("B2").Value = 0
End Sub

Best regards,
Trowa