MrExcel Publishing
Your One Stop for Excel Tips & Solutions


Posted by jo on December 26, 2001 10:48 AM

Ok, I recorded a Macro that will copy info from sheet 1 onto sheet 3. But, I can't get it to run when someone clicks on a button. The only way it will run is if you do Tools, Macro and click on Run. How can I assign the Macro to run when someone clicks on the Toggle button? Sorry, I am very new to Excel.

Posted by Jim on December 26, 2001 11:00 AM

Hi Jo,
How about creating a commandbutton to fire-off your code


Posted by Rick E on December 26, 2001 11:14 AM

If you are talking about a "Command" button, hold "Ctrl" down on the keyboard and right click the mouse on the button, a pop-up menu appears, select "Assign Macro" and the Macro Dialog box shows up, select the macro you want and click OK.

Rick E.

Posted by Tom Morales on December 26, 2001 11:17 AM

Jo - Following up on Jim's thought, you can used a button off the forms toolbar, or a commandbutton off the controls toobar. If you use one off the forms toolbar, right-click the button, and choose "Assign Macro". If you use the commandbutton, you'll have to put the macro in that button's module. (There's a button on the controls toolbar that will get you to the commandbutton module, after you've selected the commandbutton.)