Increasing and decreasing cell values
Assuming your button's name is CommandButton1, use this click event to add 1
for each button click...
Private Sub CommandButton1_Click()
ActiveCell.Value = ActiveCell.Value + 1
End Sub
For the minus 1 button, use the same code, but change the plus sign to a
minus sign.
Private Sub CommandButton2_Click()
ActiveCell.Value = ActiveCell.Value + 1
End Sub
Just select the cell you want to increment or decrement before clicking the
buttons.
Rick
"MJKelly" wrote in message
...
Hi,
I have a column of numbers which I need to adjust. I will need to add
and subtract from the original value (+1 or -1). I would like to
assign code to a button, so when it is pressed 1 is added to the cell
to the left (and another button would reduce the value by 1). I think
I could do this, hower with a list of 40 or so numbers in the column,
I wanted to use the same code for each + button and a second macro for
the - buttons. This is what I am not sure of? It just seems really
long winded to write specific code for each cell. Can you offset from
the buttons position for example?
kind regards,
Matt
|