Increment using a Command Button

K

ksears

I am trying to get a cell to go up in value at the press of a comman
button - i.e. click the button, cell A1 goes up by 1.
Please help
 
C

Chip Pearson

Use

Sub IncrementA1()
Range("A1").Value = Range("A1").Value + 1
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
J

Jason Morin

For starters:

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

HTH
Jason
Atlanta, GA
 
G

Gord Dibben

ksears

View>Toolbars>Forms.

Click on the Button tool and draw a button on your sheet.

Right-click on button and "Assign Macro".

Sub up_one()
Range("A1").Value = Range("A1").Value + 1
End Sub

Copy/paste the code to a general module in your workbook.

For more on getting started with macros see David McRitchie's site.

http://www.mvps.org/dmcritchie/excel/getstarted.htm

Gord Dibben Excel MVP
 
Top