Increment using a Command Button

  • Thread starter Thread starter ksears
  • Start date Start date
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
 
Hi ksears

Sub test()
Range("A1").Value = Range("A1").Value + 1
End Sub
 
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
 
For starters:

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

HTH
Jason
Atlanta, GA
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top