By using vba.booksticle.com you agree to our cookie policy, We and our partners operate globally and use cookies, for multiple purposes

948 Steps to 6 Figures by Learning Excel-VBA and Other Skills



Step 98 - Introduction to the Macro Recorder


Early Draft

The Macro Recorder is one of my favorite VBA features.

It allows you to learn how to write a large portion of your VBA code by:
  • Using Excel
  • Record what you do
  • Modify the recorded code to make it more flexible

    Just about anything you can do in Excel, can be recorded, which gives you 80% of the code you need. This saves you from having to memorize all the features you need to use. It also helps you learn about Excel and is really cool.

    What is a Macro?

    There are many definitions of the word "macro," but here we define it as, VBA programming code that will perform some sort of function, kind of a shortcut, and it's also known as a subroutine.

    Imagine you do the following process each day:
    1. Open 3 Excel files
    2. Merge the data
    3. Remove unneeded rows and columns
    4. Email the result to a number of people

    You could do these steps "manually" or develop VBA Macros to automate the process. Imagine instead of once per day you have to do this for 50 clients each day. Automation becomes imperative.

    Macros can:
  • Reduce errors
  • Make work less boring
  • Make you more productive
  • Do the same with fewer people
  • Do more with the same number of people
  • Gateway drug to more software development

    Commonly recorded code
  • Formatting
    • Borders
    • Fonts
    • Colors
  • PivotTables
  • Charts
  • Selecting
  • Setting cell values
  • Basically everything

    You start recording a Macro via the Ribbon
  • Developer > Record Macro

  • The Record Macro Dialog pops up

  • Press [OK] to use the default values
  • The icon changes to Stop Recording.
  • Do something you want to record in Excel
  • Show the Excel and the VB Editor window side by side

  • Press to Stop the Recording Process
  • Finding your recorded code
  • Modify the code

    If you click cell C2 the code says

    Range("C2").Select

    click cell D5 and it changes to

    Range("C5").Select

    Select C2 through C10 and you get

    Range("C2:C10").Select

    This is all within the

    Sub Macro1()
    '
    ' Macro1 Macro
    '

    '
        Range("C2:C10").Select
    End Sub


    Saving a macro workbook

    if you save the workbook you'll get the following error


  •    Table of Contents | Send us your feedback | © 2025 All Rights Reserved | Edit