ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software»
  • Computer Science & Programming

How to Use and Design Excel Macros - Part 3: Macro Basics

Updated on December 23, 2013

Back to Part 2

Starting a Macro

  1. Open Microsoft Excel
  2. Click the “View” tab
  3. Select Macros (far right icon)
  4. Either create a blank macro or record a macro

Creating a Blank Macro

  1. Press the Macro icon (Alternatively, select the word “Macros” beneath the icon and then “View Macros”)
  2. Type a name in the blank (Do not use spaces)
  3. Select “Create”

To add a hotkey later, come back to this screen and select “Options…”

Recording a Macro

  1. Select the word “Macros” beneath the icon
  2. Choose “Record Macro…”
  3. Type a name and a shortcut key and press “OK”
  4. Do whatever actions you want recorded
  5. Select the word “Macros” again and click “Stop Recording” (Alternatively, press the blue square icon in the bottom left of the screen)

Macro Editing Screen

  • In the “View Macros” box, the “Create” or “Edit” options will open the Macro Editing Screen, called Microsoft Visual Basic for Applications (VBA)
  • A blank macro will only contain Sub MacroTitle() and End Sub
  • A recorded macro will contain the code to perform the actions recorded

Macro Code Colors

  • Black – standard code
  • Blue – function Code that stands for a specific action
  • Green – text that does not affect the code (Place an apostrophe (‘) at the beginning of a line to write text)

Pre-Made Macros

  • There are many pre-made macros available online
  • If you are looking for a macro with a specific function, try finding an already made one with a simple Google search
  • You can also ask people on an Excel forum to help you make a macro, and they will provide you with a code
  • To use a pre-made macro, copy and paste the given code into your blank macro in the Macro Editing Screen

Using a Macro

To run a macro:

The long way

  1. Go to the “View Macros” screen
  2. Select the desired macro
  3. Click “Run”

The short way

  1. Use the shortcut key assigned to the macro (Ctrl + …)

Comments

    0 of 8192 characters used
    Post Comment

    No comments yet.