I need help in my project

Closed
Smarty9902 Posts 1 Registration date Saturday July 6, 2013 Status Member Last seen July 6, 2013 - Jul 6, 2013 at 10:08 PM
TrowaD Posts 2913 Registration date Sunday September 12, 2010 Status Moderator Last seen November 21, 2022 - Jul 16, 2013 at 11:10 AM
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

TrowaD Posts 2913 Registration date Sunday September 12, 2010 Status Moderator Last seen November 21, 2022 541
Jul 16, 2013 at 11:10 AM
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
0