a button to add 1 to a cell

  • Thread starter Thread starter Ron
  • Start date Start date
R

Ron

I need to create a button that will ADD 1 to a cell everytime I click it.
Actually 3 bottons (1,5,10). I will need to repeat these buttons for 50
students to their total score. I don't know if this matters. I don't mind
creating buttons as long as they're easy to program.
Help Obe Wan
 
I don't understand "put them into your sheet first"
I am using Access 2007 if that helps.
How do I "put" them?
Thanks again,
Ron
 
I believe JBeaucaire meant the VBA sheet first. However, you just mentioned
that you are using Access, and this is the Excel newsgroup. Are you in the
right forum? If you meant Excel...

From spreadsheet, right click on sheet name, choose "view code". Paste
JBeaucaire's code there.
 
Sub add_1_to_range()
Dim rng As Range, ocell As Range
Set rng = Range("B2:B173")
For Each ocell In rng
If ocell.Value <> "" And Application.IsNumber(ocell.Value) Then
ocell.Value = ocell.Value + 1
End If
Next
End Sub


Gord Dibben Microsoft Excel MVP
 
Back
Top