ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Command Button Function (https://www.excelbanter.com/excel-programming/382690-command-button-function.html)

Bob

Command Button Function
 
I am setting up a simple interface in which I want to click Button1 and then
Button2 to increase the value in cell E2 by 1. I want the value to increase
by 1 each time I click these two button in sequence.

Can anyone provide the code to accomplish this?

thanks,
Bob

Gary''s Student

Command Button Function
 
Make two buttons using the Forms toolbar. Then enter:

Dim arm_it As Boolean

Sub but1()
arm_it = True
End Sub

Sub but2()
If arm_it Then
arm_it = False
Range("E2").Value = Range("E2") + 1
End If
End Sub


in a standard module and assign the first button to but1, etc.
--
Gary's Student
gsnu200704


"bob" wrote:

I am setting up a simple interface in which I want to click Button1 and then
Button2 to increase the value in cell E2 by 1. I want the value to increase
by 1 each time I click these two button in sequence.

Can anyone provide the code to accomplish this?

thanks,
Bob



All times are GMT +1. The time now is 01:27 PM.

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