I want to place a button in a excel spreed sheet cell and every time I press the button I want the cell next to it to count how many times the button has been pushed.
Put a button in the desired cell by using the forms toolbar. Excel will ask for a macro to associate with the button - you can accept the default name (button1_click),
and then add a macro (in a new or an existing module):
Code:
Sub button1_click()
Dim counter As Range
Set counter = ActiveSheet.Shapes("Button 1").TopLeftCell.Offset(0, 1)
counter = counter + 1
End Sub
You can move the button around the worksheet - it will always increment the cell immediately to the right of it.
Rob
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.