Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() im having a bit of trouble with this coding i want to add a value of one to a cell to keep a running total no matter what number is put into that cell theres more info down below please could anyone help me? Private Sub Submit_Click() Dim x As Integer Dim one As Integer Dim two As Integer Dim three As Integer Dim four As Integer Dim five As Integer one = 1 two = 1 three = 1 four = 1 five = 1 x = Range("a1").Value Range("a1").Value = Range("a2").Value Range("a2").Value = x + ActiveCell.FormulaR1C1 = "sum(+1)" 'here instead of swopping the values each time a number one to five is 'entered i want 1 to be added so that cell a2 keeps a running total so 'if 9 was entered into cell a1 then 1 would be added to cell a2 then if '7 was entered into cell a1 then 1 would be addedd to the one already in 'cell a2 making the total in that cell 2 End Sub -- RELWOD85 ------------------------------------------------------------------------ RELWOD85's Profile: http://www.excelforum.com/member.php...o&userid=25753 View this thread: http://www.excelforum.com/showthread...hreadid=392323 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
To increment A2 by 1 each time: Range("a2").value=Range("a2").value+1 It's not clear to me what the overall logic is - Is it simply to increment A2 every time a value is put in A1?. HTH "RELWOD85" wrote: im having a bit of trouble with this coding i want to add a value of one to a cell to keep a running total no matter what number is put into that cell theres more info down below please could anyone help me? Private Sub Submit_Click() Dim x As Integer Dim one As Integer Dim two As Integer Dim three As Integer Dim four As Integer Dim five As Integer one = 1 two = 1 three = 1 four = 1 five = 1 x = Range("a1").Value Range("a1").Value = Range("a2").Value Range("a2").Value = x + ActiveCell.FormulaR1C1 = "sum(+1)" 'here instead of swopping the values each time a number one to five is 'entered i want 1 to be added so that cell a2 keeps a running total so 'if 9 was entered into cell a1 then 1 would be added to cell a2 then if '7 was entered into cell a1 then 1 would be addedd to the one already in 'cell a2 making the total in that cell 2 End Sub -- RELWOD85 ------------------------------------------------------------------------ RELWOD85's Profile: http://www.excelforum.com/member.php...o&userid=25753 View this thread: http://www.excelforum.com/showthread...hreadid=392323 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Adding entry in one cell to a running total in another cell | Excel Worksheet Functions | |||
keeping a running total in a single cell | Excel Worksheet Functions | |||
KEEPING THE TOTAL IN C3 WHEN ADDING B3 | Excel Discussion (Misc queries) | |||
KEEPING THE TOTAL IN C3 WHEN ADDING B3 | Excel Discussion (Misc queries) | |||
Keeping formulas on running total and sorts | Excel Worksheet Functions |