ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Command button to run a macro (https://www.excelbanter.com/excel-programming/380662-command-button-run-macro.html)

CY

Command button to run a macro
 
How can I use VBA to assign a command button to run a specific macro.

Please help!



goohead

Command button to run a macro
 
On an excel worksheet, Click on Tools -Customize -on Toolbars Tab -
Click Visual Basic
- this will bring out a VB design window.

- On VB design window, bring your cursor on design mode and click it.
you are now on design mode.

- Still on VB design window, bring your cursor on Control Toolbox and
click it, - this will out a control toolbox window that contains
several objects such as button, listbox, etc.

- Click on Commandbutton and position your cursor where you want to
put the button.
- Right click the button( you are still on design mode) and click on
View code. This will open the VB Window where you can enter your code.
Enter your code where the cursor is blinking. ( Right click on the
button to change it Properties such as its label, color...)

Get out of design mode by clicking on Design Mode on the visual basic
window( it should still be showing on the window where you enter your
code.

To check your work, go to the excel worksheet and click on the button.

Let me know if this helps...

Steve

CY wrote:
How can I use VBA to assign a command button to run a specific macro.

Please help!




All times are GMT +1. The time now is 04:57 AM.

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