Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Buttons for excel

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
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
 
Rob thank you for the tip. It worked just the way I wanted it to. Thanks again, Mash
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top