ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   buttons in excel 2003 (https://www.excelbanter.com/new-users-excel/167692-buttons-excel-2003-a.html)

neilb514

buttons in excel 2003
 
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.

Bernard Liengme

buttons in excel 2003
 
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

"neilb514" wrote in message
...
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.




neilb514

buttons in excel 2003
 
Absolutly fantastic,
thankyou.




"Bernard Liengme" wrote:

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

"neilb514" wrote in message
...
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.





Gord Dibben

buttons in excel 2003
 
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

On Wed, 28 Nov 2007 09:53:03 -0800, neilb514
wrote:

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.




All times are GMT +1. The time now is 05:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com