Command button to run a macro

G

goohead

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top