banner



How To Create A Macro In Excel 2013

excelmacroMacros are little programs that run within Excel and help automate common repetitive tasks. Macros are one of Excel's most powerful, yet underutilized feature. Using macros, you can save hours and boost productivity manifold.

In this blog post, we will learn how to create an ultra-simple macro in Excel 2013 to introduce you to the concept. For a more detailed overview of advanced Excel functions, including creating complicated macros, try the comprehensive Excel training course for beginners and intermediate users.

What is a Macro?

A macro can be defined as the recording of a series of tasks. It's the simplest form of automation – show a software program the steps you follow to get something done, and the software will follow along. When used right, macros can save you hours by automating simple, repetitive tasks.

Marcos in Excel are written in Excel VBA (Visual Basic for Applications). This is a version of Visual Basic (a prominent Microsoft programming language) developed specifically for use in Office-like applications. Creating simple macros – copy a formula from one cell to another, for instance – is fairly easy. Complicated macros require a bit more work. You'll need to be quite intimate with Excel VBA to automate the more complex tasks in your workflow. You can learn more about these in this advanced Excel 2010 course.

For this tutorial, we will create a very simple macro to get you up to speed with Excel programming and automation.

Step 1: Activate the Developer Toolbar

To write macros, you will need access to the Developer toolbar in the top ribbon. This is hidden by default. To activate it, go to File -> Options -> Customize Ribbon and check the box next to 'Developer'.

Press OK. You should now see the Developer toolbar in the ribbon.

Step 2: Enable Macros

Macros are disabled by default in Excel. This is to protect you from malicious macros running automatically in downloaded Excel files.

To use macros, you will have to first enable them from the Trust Center. To do this, go to File -> Options -> Trust Center. Click on the 'Trust Center Settings' button in this menu.

In this new window, go to 'Macro Settings' and select the 'Enable all macros' radio button.

Click OK. You can now start using macros in your Excel spreadsheets.

Step 3: Prepare the Spreadsheet

In this tutorial, we will create a very simple macro to change the color, size and boldness of text.

In your spreadsheet, type in some text in any of the cells. We will later record a macro to change the formatting of this text.

Now that our spreadsheet is ready, we can start creating the macro.

Step 4: Create a New Macro

In the 'Developer' tab, click on 'Record Macro'

A pop-up window will ask you to give a name, storage location, shortcut and description for the macro.

Type in whatever you like over here. It helps to be descriptive with your macro titles. You might end up using dozens of macros in a large spreadsheet. Being able to quickly find individual macros by name will save you hours of frustration later. It's also a good practice to add a description to remind you what the macro actually does.

Two important considerations here:

  • Shortcut Key: The shortcut key gives you quick access to the macro. Using a custom shortcut is highly recommended – you are using macros to save time, after all. A lot of default Excel functions are locked in to use the CTRL + Letter/Number shortcut format. To avoid conflicts with existing shortcuts, add not at least two keys to the shortcut – something like CTRL + SHIFT + A, or CTRL + A + 1

  • Store Macro in: In this drop down menu, you can decide where to save the macro. If you choose 'This Workbook', the macro will be available for use in the existing workbook only. Choosing 'New Workbook' will, as you guessed, save the macro in a new workbook. The most powerful option here is to save the macro in 'Personal Macro Workbook'. Macros stored in this workbook are available across all your workbooks. Think of it as a central repository for every macro that you create. The actual macro workbook file itself will be hidden the Windows AppData folder, but it will load up automatically when you start Excel, giving you complete access to all macros.

For the purpose of this tutorial, we will give our macro a shortcut of CTRL + SHIFT + A and store it within the same workbook.

Not sure how macros work? Try this comprehensive program to learn Excel 2010 from scratch.

Step 5: Record the Macro

Once you've entered all the require details, click OK. Your macro is now being recorded.

Select the cell where you entered your text. Switch to the 'Home' tab and change its color to red, font size to 18, and font weight to 'bold'.

When you're done, click on the 'Stop Recording' button in the Developer tab, or hit the small square block at the bottom of the spreadsheet next to 'Ready'.

You have now successfully recorded an Excel macro!

Step 6: Test the Macro

Now that you've recorded your first macro, it's time to see it live.

Add a few more blocks of text to your spreadsheet, one cell at a time. You might have to change the default formatting back to black font, 11 point font size and normal text.

Once you've added the text, simply select any cell and press the shortcut for your macro (CTRL + SHIFT + A). The formatting will immediately change to 18 pt. bold font in red color. You can apply this to each cell at a time, or select multiple cells together.

The formatting changes that would otherwise take you multiple clicks now take just one keystroke.

This is one of the most basic macros you can create. As you can imagine, complex macros can be created to perform very complicated tasks. You can learn more about creating such macros with Excel VBA programming in this Excel training course for advanced topics.

Was this tutorial helpful? We'd love to learn your thoughts and opinions! Share them with us in the comments below.

How To Create A Macro In Excel 2013

Source: https://blog.udemy.com/excel-macros-tutorial/

Posted by: mooreforgerd.blogspot.com

0 Response to "How To Create A Macro In Excel 2013"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel