Download ArticleDownload Article

While Excel is full of time-saving features like keyboard shortcuts and templates, you can save even more time by creating macros to complete repetitive tasks. This How.com.vn teaches how to create simple macros for Excel spreadsheets.

Part 1
Part 1 of 3:

Enabling The Developer Tab

Download Article
  1. 1
    Open Excel. The process for showing the Developer tab is the same for many versions of Excel for Windows. There is a slight difference for Excel for Mac, which will be detailed below.
  2. How.com.vn English: Step 2 Click the File tab.
    It's in the editing ribbon above your document space.
    • In Excel for Mac, click the "Excel" menu at the top of your screen.
    Advertisement
  3. How.com.vn English: Step 3 Click Options.
    You might find this option at the bottom of the menu.
    • In Excel for Mac, click the "Preferences" menu option.
  4. How.com.vn English: Step 4 Click Customize Ribbon.
    It's in the panel on the left side of the window.
    • In Excel for Mac, click "Ribbon & Toolbar" in the "Authoring" section.
  5. Step 5 Check the box next to "Developer" to check it.
    You'll see this on the right side of the window under the header, "Main Tabs."
    • In Excel for Mac, you'll see "Developer" in the "Tab or Group Title" list.
  6. How.com.vn English: Step 6 Click OK.
    You'll see the Developer tab appear in your tab list.
  7. Advertisement
Part 2
Part 2 of 3:

Recording a Macro

Download Article
  1. How.com.vn English: Step 1 Click the Developer tab.You should see this in the editing ribbon above your editing space.
    If you don't see it, you need to enable it again.
  2. How.com.vn English: Step 2 Click Record Macro.
    You'll find this in the Code section of the Developer tab. You can also press Alt+T+M+R to start a new macro (Windows only).
  3. How.com.vn English: Step 3 Give the macro a name.
    Make sure that you'll be able to easily identify it, especially if you're going to be creating multiple macros.
    • You can also add a description to explain what the macro will accomplish.
  4. How.com.vn English: Step 4 Click the Shortcut key field.
    You can assign a keyboard shortcut to the macro to easily run it. This is optional.
  5. How.com.vn English: Step 5 Press ⇧ Shift plus a letter.
    This will create a Ctrl+ Shift+letter keyboard combination to start the macro. If you don't press Shift, then you run the risk of overwriting any keyboard shortcuts that already exist. For instance, if you entered z in the box without pressing Shift, you'd overwrite the "Undo" shortcut (which is Ctrl + Z)
    • On Mac, this will be a Opt+ Command+letter combination.
  6. How.com.vn English: Step 6 Click the Store macro in drop-down.
    More options will drop down for you.
  7. How.com.vn English: Step 7 Click the location you want to save the macro.
    If you're only using the macro for your current spreadsheet, just leave it on "This Workbook." If you want the macro available for any spreadsheet you work on, select "Personal Macro Workbook."
  8. How.com.vn English: Step 8 Click OK.
    Your macro will begin recording.
  9. How.com.vn English: Step 9 Perform the commands you want to record.
    Pretty much anything you do will now be recorded and added to the macro. For example, if you run a sum formula of A2 and B2 in cell C7, running the macro in the future will always sum A2 and B2 and display the results in C7.
    • Macros can get very complex, and you can even use them to open other Office programs. When the macro is recording, virtually everything you do in Excel is added to the macro.[1]
  10. How.com.vn English: Step 10 Click Stop Recording when you're finished.
    This will end the macro recording and save it.
  11. How.com.vn English: Step 11 Save your file in a macro-enabled format.
    In order to preserve your macros, you'll need to save your workbook as a special macro-enabled Excel format:
    • Click the File menu and select Save.
    • Click the File Type menu underneath the file name field.
    • Click Excel Macro-Enabled Workbook.
  12. Advertisement
Part 3
Part 3 of 3:

Using a Macro

Download Article
  1. 1
    Open your macro-enabled workbook file. If you have closed your file before running your macro, you'll be prompted to enable the content.
  2. How.com.vn English: Step 2 Click Enable Content.
    This appears at the top of the Excel spreadsheet in a Security Warning bar whenever a macro-enabled workbook is opened. Since it's your own file, you can trust it, but be very careful opening macro-enabled files from any other source.
  3. 3
    Press your macro shortcut (if you want to use a shortcut key). When you want to use your macro, you can quickly run it by pressing the shortcut you created for it.
  4. How.com.vn English: Step 4 Click the Macros button in the Developer tab (if you want to use the menu).
    This will display all of the macros that are available in your current spreadsheet.
  5. How.com.vn English: Step 5 Click the macro you want to run.
  6. How.com.vn English: Step 6 Click the Run button (if you have custom buttons enabled).
    The macro will be run in your current cell or selection.
    • If you don't have custom buttons enabled, you can go to Customize Ribbon and add it there.[2]
  7. How.com.vn English: Step 7 View a macro's code.
    If you want to learn more about how macro coding works, you can open the code of any macro you've created and tinker with it:
    • Click the Macros button in the Developer tab.
    • Click the macro you want to view.
    • Click the Edit button.
    • View your macro code in the Visual Basic code editing window.
  8. Advertisement

Community Q&A

Search
Add New Question
  • Question
    If I have two lines of dates in one cell, how do I delete the first line?
    How.com.vn English: Community Answer
    Community Answer
    Double click on the cell, or click the cell and then F2. Then, delete the part that you don't need. If you want to do this on a large number of cells on the same column, then select the column, click "DATA" on the top menu, click on "Text to Columns," and try the different options to divide the data there. (There are too many to list here.) You can divide by commas, spaces, dashes, periods, etc., or specify the length. Make sure the columns on the right are empty; the divided data will split into those columns.
  • Question
    While recording a macro, will it record something I want done outside of Excel, such as opening up a website and clicking on things in that website?
    How.com.vn English: Community Answer
    Community Answer
    No. The macro program in Excel is limited to Excel. Once you use an outside program, Excel will be unable to record what you are doing.
  • Question
    How do I secure files in Excel?
    How.com.vn English: Community Answer
    Community Answer
    Click the Microsoft Office button, point to Prepare, and then click Encrypt Document.In the Password box, type a password, and then click OK.In the Reenter Password box, type the password again, and then click OK.To save the password, save the file.
See more answers
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
      Advertisement

      Tips

      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Thanks for submitting a tip for review!

      About This Article

      How.com.vn English: Darlene Antonelli, MA
      Written by:
      How.com.vn Technology Writer
      This article was co-authored by How.com.vn staff writer, Darlene Antonelli, MA. Darlene Antonelli is a Technology Writer and Editor for How.com.vn. Darlene has experience teaching college courses, writing technology-related articles, and working hands-on in the technology field. She earned an MA in Writing from Rowan University in 2012 and wrote her thesis on online communities and the personalities curated in such communities. This article has been viewed 1,614,291 times.
      How helpful is this?
      Co-authors: 31
      Updated: February 2, 2023
      Views: 1,614,291
      Article SummaryX

      1. Enable macros.
      2. Click the Developer tab.
      3. Click Record Macro.
      4. Name the macro.
      5. Specify a shortcut key.
      6. Select This Workbook under “Store macro in.”
      7. Click OK.
      8. Perform the commands you want to record.
      9. Click Stop Recording when finished.
      10. Save the file as a Macro-Enabled Workbook (*.xlsm).

      Did this summary help you?

      Thanks to all authors for creating a page that has been read 1,614,291 times.

      Reader Success Stories

      • How.com.vn English: Nicholas Johnson

        Nicholas Johnson

        Jul 18, 2017

        "I'm just a Mechanical Engineering major trying to learn about Excel further, and this has been helpful to get..." more
        Rated this article:
      Share your story

      Is this article up to date?

      ⚠️ Disclaimer:

      Content from Wiki How English language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
      Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

      Notices:
      • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
      • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
      • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
      • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

      Advertisement