Working with Macros in Excel 2007

Written by:  • Edited by: Tricia Goss
Updated May 14, 2009
• Related Guides: Microsoft | Macro | Excel

In this Excel 2007 guide, we’ll show how to quickly automate tasks by recording a macro. We’ll also discuss how to execute macros after they’ve been created.

Macros in Excel

While there are a number of features and tools in Excel 2007 that can be used to optimize and speed up workflow, there are still series of tasks and commands that many users will find very repetitive and time consuming. However, it is possible to create a custom macro that will execute such a sequence of commands on your behalf with just one click of a button. In the steps below, we’ll show how easy it is to construct a standard macro in Excel.

How to Record a Macro

Step 1: Make sure the Developer tab is shown on the Excel ribbon. If it is not, you can add it by clicking on the Office button and then selecting Excel Options. (Click any image for a larger view.)

Excel Options
click to enlarge

In the Excel Options window, select Popular from the list of categories in the left hand panel. Put a check in the box next to Show Developer tab in the Ribbon.

Show Developer Tab
click to enlarge

Click the OK button to return to Excel. The Developer tab will now be present on the ribbon.

Step 2: Open the Developer tab, click the Record Macro button.

Record Macro Button
click to enlarge

Note that the main Macros button can also be found on the View tab of the Excel ribbon, but the Developer tab contains more advanced macro tools so it’s worth the extra couple of moments it took to add it to the ribbon.

Step 3: In the Record Macro window, enter a name and description for the new macro. At this time, you can also assign a shortcut to the macro for later use. From the drop down box next to Store macro in, pick the workbook in which you want to store the macro. If you want the macro to be accessible in any Excel file, choose Personal Macro Workbook. Select This Workbook if the current spreadsheet is the only one in which you plan to use the macro.

Record Macro Button
click to enlarge

Click OK to continue.

Step 4: Perform all of the actions that you want included in the macro. When done, click the Stop Recording button on the Developer tab.

Stop Recording Macro
click to enlarge

How to Run a Macro

After a macro has been created, you can run it in two ways:

If you assigned a shortcut to the macro, you can type that key sequence to run the macro.

Alternatively, click on the Macros button on the Developer tab. When the macro dialog box appears on your screen, select the macro you want to execute and click Run.

Run a Macro
click to enlarge

Be sure to browse through the other Microsoft Excel user guides available here at Bright Hub. Learn how to publish an Excel workbook as a web page, experiment with new chart and table design tips, find out how to use conditional formatting to make your data analysis easier, and more. Additional tutorials are being added on a regular basis so keep checking back.


Comments

Showing all 10 comments
 
Rafi Aug 12, 2011 5:50 AM
I want learn how to creat Macros Step By Step.
Hi , I Just want to Learn how to crest Macros step by step, Can you able to Provide me the steps if Pisible.Thank you
Michele McDonough Mar 29, 2011 9:20 AM
Security Settings
You may need to adjust your security settings - here is a link that explains how:

http://www.brighthub.com/computing/windows-platform/articles/27504.aspx
Hitesh Mar 29, 2011 9:04 AM
Security Error
Dear i have start learning macro as per above mention instructions but there is showing Security Error, i cann't understand.

Please guide.
abdul rasheed Mar 17, 2011 5:10 AM
run macro
the run macro is hided, it is not able to click and use it, what can i do?
Ashutosh Singh Mar 1, 2011 3:46 PM
Adding two macros and got failed
I m having problem by adding two macros in one sheet, because to reduce work efficiency,please help me out.
rakesh yadav Feb 11, 2011 5:34 AM
macro in excel-2007
hi,
i want to know how i create & run macro in excel 2007.
Ashok Shah Jan 23, 2011 3:05 AM
Insertion of Rows and Columns through macro
I want to take out seperately transactions line items (Say 45 line items) for a particular customer from the data base of all the customer (having 54000 line items). I got the 45 as answers when I used comfmand for :count: for that particular customer. Now this 45 line items I want to copy in a seperate sheet. So how to perform this function in a macro so that I get desired result.

Ashok Shah
vadiraj May 18, 2010 6:26 AM
Need to create a macro for a Big files
I am having a problem with big files.. I tried thrice , by creating a macro for a Bis files in Excel 2007... But I couldnt run properly .. it was not well formatted.. could you help me out
sam Mar 9, 2010 5:42 PM
A+
thank you for the great help i can now do invoices and clear them with ease A++
Gerald Keen Aug 6, 2009 12:36 PM
what you cannot do with a Macro
It would appear that you cannot enter any ribbon navigation in a Macro recording. It tried, failed, and Excel help told me as much when I then looked.

given that Menu (aka ribbon) navigation is one key use for macros, this is a pain and should be pointed out in your article. Unless, of course, it can be done but if so, how?
 
blog comments powered by Disqus
Email to a friend