![]() |
userform
G'day Group,
How is a connection from a command button made to a macro. For instance if I wanted to push a button to run a macro that I created by using the recorder. Thanks Bruce |
userform
Bruce
The commandbuttons on userforms use events (as do all controls). Specifically, you want the Click event of the commandbutton. Right-click on the commandbutton and choose View Code. Now you have two options (at least). You can paste your recorded code into the Click event, or you can call your recorded macro from within the event sub. If you paste, be sure to omit the Sub and End Sub lines from the recorded macro. The Sub line for event macro is pre-defined and should not be altered. To call the recorded macro (let's say it's named macro1), the event sub would look like this: Private Sub CommandButton1_Click() macro1 End Sub -- Dick Kusleika MVP - Excel www.dicks-clicks.com Post all replies to the newsgroup. "Bruce Minty" wrote in message ... G'day Group, How is a connection from a command button made to a macro. For instance if I wanted to push a button to run a macro that I created by using the recorder. Thanks Bruce |
All times are GMT +1. The time now is 08:27 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com