ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to assign a macro to a button (https://www.excelbanter.com/excel-programming/374163-how-assign-macro-button.html)

WANNABE

How to assign a macro to a button
 
I have a procedure that consists of 4 subs, they are all saved in a module
"Update", the first sub calls out to the others in order. I would like to
run this from a button on the spreadsheet. However when I create the
button, and select 'view code' it creates a macro in the spreadsheet. Can
this be redirected to run from the module or can I call my Update module
from it, and please tell me how ???



WANNABE

How to assign a macro to a button
 
I may have answered my own question Application.Run ("Update") will call
out and run the public sub in the module. But if there is a way to have the
button run the module public sub without going through the worksheet sub,
please let me know...
Thanks...
=========================================
"WANNABE" <breichenbach AT istate DOT com wrote in message
...
I have a procedure that consists of 4 subs, they are all saved in a module
"Update", the first sub calls out to the others in order. I would like to
run this from a button on the spreadsheet. However when I create the
button, and select 'view code' it creates a macro in the spreadsheet. Can
this be redirected to run from the module or can I call my Update module
from it, and please tell me how ???




Ron de Bruin

How to assign a macro to a button
 
Hi WANNABE

Enter the macro name in the click event of the button

Private Sub CommandButton1_Click()
Call yourMacroName
End Sub

Or use a button from the Forms toolbar
you can right click on it and use Assign macro

--
Regards Ron de Bruin
http://www.rondebruin.nl



"WANNABE" <breichenbach AT istate DOT com wrote in message ...
I have a procedure that consists of 4 subs, they are all saved in a module "Update", the first sub calls out to the others in
order. I would like to run this from a button on the spreadsheet. However when I create the button, and select 'view code' it
creates a macro in the spreadsheet. Can this be redirected to run from the module or can I call my Update module from it, and
please tell me how ???





All times are GMT +1. The time now is 03:40 PM.

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