adding a cell to a cell keeping a running total please help

R

RELWOD85

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top