EXCEL VIDEO TUTORIALS / EXCEL DASHBOARD REPORTS

Ozgrid, Experts in Microsoft Excel Spreadsheets

Assign Macros in Excel

| | Information Helpful? Why Not Donate.

 

Assign Macros in Excel/Assigning Excel Macros to Objects

ASSIGNING MACROS TO A SHORTCUT KEY, OBJECT, COMMAND BUTTON OR A TOOLBAR

Once you have recorded your Excel macro , there are a number of ways that you can run it. To go via the Macro dialog box in the menu system go to Tools>Macro>Macros (Alt+F8), click on the name of the macro you wish to run and select Run. There are also a number of much quicker alternatives:

ASSIGNING A MACRO TO AN OBJECT

To assign a macro to an object, select an object from the drawing toolbar, then right click and go to Assign Macro, select the macro you wish to assign, then click OK. (You can double click as well)

ASSIGN A MACRO TO A SHORT-CUT KEY

Assigning a macro to a shortcut key can be done at the first stage of recording a macro, when your Record Macro dialog first pops up to ask you to give it a name. The second step asks for a Shortcut key. Note that if you select a shortcut that is already in use (such as Ctrl C for Copy), the original command will be overridden and replaced with your macro.

If you have already created your macro and wish to then go back and assign it to a shortcut key, go to Tools>Macro>Macros (Alt+F8), then select the Options button and enter in the shortcut key you would like to use.

ASSIGNING A MACRO TO A BUTTON FROM THE FORMS TOOLBAR

You can easily assign a macro to a button from the Forms Toolbar. To do this, go to View>Toolbars>Forms to show your Forms Toolbar, then select the Button icon and draw a button on your worksheet. Immediately when you let go of your button, the Assign Macro dialog will pop up. Select the macro you wish to assign, then click OK. Note that if you select the border of the button, then right click, extra options, such as the ability to name your button, and again the option to Assign a Macro to the button if you have not already done so.

ASSIGNING A MACRO TO A COMMAND BUTTON FROM THE CONTROL TOOLBOX

You can also assign a macro to a Command Button from the Control Toolbox, giving you much greater flexibility than using a button from the Forms Toolbar. This is because the Control Toolbox uses ActiveX controls. Go here to read the difference between ActiveX controls and other controls To do this, go to View>Toolbars>Control Toolbox to show the Control Toolbox Toolbar, then select the Command Button icon and draw a button on your worksheet. Note than when you do this the button becomes an embedded Object of the Worksheet Object, giving you greater flexibility and access to many visual properties of the button, by right clicking on the Command Button and choosing Properties. To assign a macro, double click on the button and type in the words: Run "name_of_your_macro_here" make sure thename of your macro is in inverted commas.

ASSIGNING A MACRO TO A TOOLBAR

The final way you can run a macro is to assign it to a toolbar. To do this, go to View>Toolbars>Customize and select the Commands tab. Scroll through the Categories list until you get to the Macros option and select it. in the right pane, select Custom Button (smiley face) and drag to the desired location your toolbar. Click the Modify Selection button and you will see the Assign Macro option at the bottom of the list. Click on it and the Assign Macro dialog will pop up. Select the macro you wish to assign and click OK. There are many other options here such as giving a Name to your button, or changing the image. We want click Close when you have made any other changes.

See Also: Record Excel Macros | Create Custom Toolbars

Excel Dashboard Reports & Excel Dashboard Charts 50% Off Become an ExcelUser Affiliate & Earn Money

Special! Free Choice of Complete Excel Training Course OR Excel Add-ins Collection on all purchases totaling over $64.00. ALL purchases totaling over $150.00 gets you BOTH! Purchases MUST be made via this site. Send payment proof to special@ozgrid.com 31 days after purchase date.


Instant Download and Money Back Guarantee on Most Software

EXCEL VIDEO TUTORIALS / EXCEL DASHBOARD REPORTS

Excel Trader Package Technical Analysis in Excel With $139.00 of FREE software!

Microsoft and Microsoft Excel are registered trademarks of Microsoft Corporation. OzGrid is in no way associated with Microsoft

Some of our more popular products are below...
Convert Excel Spreadsheets To Webpages | Trading In Excel | Construction Estimators | Finance Templates & Add-ins Bundle | Code-VBA | Smart-VBA | Print-VBA | Excel Data Manipulation & Analysis | Convert MS Office Applications To...... | Analyzer Excel | Downloader Excel | MSSQL Migration Toolkit | Monte Carlo Add-in | Excel Costing Templates