ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   commands button (https://www.excelbanter.com/excel-programming/332716-commands-button.html)

PTS

commands button
 
is there a way to create a button in your spreadsheet which completes a
single command. Ie add 3 to a cell over and over so it just keeps increasing
everytime you push the button

Harald Staff

commands button
 
Sure.

Open the VB editor (Alt F11 or similar).
Menu Insert Module.
Paste this into the module:

Sub Add3()
Range("C14").Value = Range("C14").Value + 3
End Sub

Return to Excel.
Show the Forms toolbar if it's hidden (View menu).
Put a button from it onto the worksheet.
Rightclick the button.
Choose Assign Macro, assign Add3 to it.
Voila.

HTH. Best wishes Harald


"pts" skrev i melding
...
is there a way to create a button in your spreadsheet which completes a
single command. Ie add 3 to a cell over and over so it just keeps
increasing
everytime you push the button





All times are GMT +1. The time now is 05:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com