ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Creat a command button (https://www.excelbanter.com/excel-programming/342113-creat-command-button.html)

comotoman[_4_]

Creat a command button
 

How do I create a command button on my sheet to run a macro?


--
comotoman
------------------------------------------------------------------------
comotoman's Profile: http://www.excelforum.com/member.php...o&userid=27292
View this thread: http://www.excelforum.com/showthread...hreadid=473863


Jim Thomlinson[_4_]

Creat a command button
 
There are 2 kinds of buttons. One comes from the forms toolbar and the other
comes from the control toolbox. They work a little different so I will
explain each.

Control Toolbox - This is the button I use 99% of the time. It is the most
fimilliar to people who are familliar with coding in VB. A button is embeded
right in the sheet and the code written lands in the sheet (not in a module).
Drag a button off the control toolbox and righ click on it. Select Properties
and here you can modify the look and function of the button There are lost of
choices. You deffinietly want to change name to something like cmdMyButton
and the caption to a description of the action the button does, like "Copy
Stuff". Right click on the button again and choose view code. Now you can
write code for the button to do.

Forms Toolbar - The button from this menu is more like a picture of a
button. When you add the button you will be promted to link it to a macro. It
could be any publicly declared procedure written in a module (recorded macros
qualify here). The buttons do not have as many options as the control toolbox
but they work in a pinch...
--
HTH...

Jim Thomlinson


"comotoman" wrote:


How do I create a command button on my sheet to run a macro?


--
comotoman
------------------------------------------------------------------------
comotoman's Profile: http://www.excelforum.com/member.php...o&userid=27292
View this thread: http://www.excelforum.com/showthread...hreadid=473863




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

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