buttons in excel 2003

  • Thread starter Thread starter neilb514
  • Start date Start date
N

neilb514

Hi
I have just put 2 buttons in a worksheet. I want the 1st button to put a
value of plus 1 every time it is pushed in a specific cell. ie if it is
pushed 3 times to display 3 in a specific cell. I want the other button to do
the same only minus. ie if it is pushed 3 times to display -3 in a specific
cell.
I am very new to this any help will be appretiated.
 
I will assume you used the button for the Forms toolbar rather than an The
Controls Toolbar.

Right click the first button; select Assign Macro; click the New option
Copy this to the module, change A1 to whatever cell you want incremented

Sub Button1_Click()
Range("A1") = Range("A1") + 1
End Sub

If New is unavailable click Edit and fix the sub to read as above

Repeat for second button using
Sub Button2_Click()
Range("A1") = Range("A1") - 1
End Sub


If you are using a Command Button: right click it and select View Code and
use

Private Sub CommandButton1_Click()
Range("A1") = Range("A1") + 1
End Sub

You will need to click a cell to exit Edit mode on the button
best wishes
 
Absolutly fantastic,
thankyou.




Bernard Liengme said:
I will assume you used the button for the Forms toolbar rather than an The
Controls Toolbar.

Right click the first button; select Assign Macro; click the New option
Copy this to the module, change A1 to whatever cell you want incremented

Sub Button1_Click()
Range("A1") = Range("A1") + 1
End Sub

If New is unavailable click Edit and fix the sub to read as above

Repeat for second button using
Sub Button2_Click()
Range("A1") = Range("A1") - 1
End Sub


If you are using a Command Button: right click it and select View Code and
use

Private Sub CommandButton1_Click()
Range("A1") = Range("A1") + 1
End Sub

You will need to click a cell to exit Edit mode on the button
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email
 
You could use Spinner buttons from the Forms Toolbar linked to your cell(s) to
go up or down at a click.

Or see Bernie's response which could be more what you want.


Gord Dibben MS Excel MVP
 
Back
Top