Excel Macro Monday – Watch Excel Record Your Macro In Real Time


Hello Excellers and welcome to another blog post in my #macromonday series. This is the place where we discuss all things Excel macro and Excel VBA. Today I want to share with you real-time VBA being recorded as you build your own macro in Excel. If you are new to Excel and Macros then you may or may not be aware that Excel contains a Macro Recorder. This creates the VBA code for all of the actions you perform.

You can easily use the Excel Macro Recorder to perform regular and repetitive tasks. You can then run the recorder at a later date on a regular basis to save time and effort. There is no better way to learn this than work through an Excel VBA example. So let’s record a macro that will convert centre our text across a selection of cells.

The Developer Tab

Before you can race ahead and record your own Macro, you need to enable the developer tab in Excel. If you want more information on how to enable the developer tab then please read the blog post below, or you can watch my YouTube Tutorial also linked below.

How To Enable The Developer Tab In Excel

Once you are all set with your developer tab on your Ribbon then you are all set to record your macro.

Recording The Example Macro And Watch The VBA Code Being Created

We set out in this example to centre our text across a selection of cells. So, we need to click on the Developer Tab then select Record Macro. Excel will display a pop box which is the Record Macro Box. At this point, you will be asked to name your macro. In this example let’s call it ‘centre_across_selection’.

After the prompt to save the macro in the current workbook or your Personal Macro Workbook. Subsequently, the Excel VBA code stored in your Personal Macro workbook will be made available in any active Excel session that you open. As a result, it is really easy to keep all off your Excel VBA Macro’s together in one place. If applicable I usually store my macros in this location unless the macros are very specific to a single workbook.

If you have the VB Editor open at this stage you will see this happening in real time. So, this is the code that the VBA Recorder generated as I carry out the steps require to centre my text.

 

So we have recorded an Example Excel macro and watched the live code being generated in real time. All we need to do is make the macro available to run each time we need it. There are a few ways to run the macro.

  1. Assign a macro shortcut key. To read more about assigning a shortcut key to your macro then read my blog post => How To Assign Or Change A Macro Shortcut Key
  2. Attach or assign your macro to a button. You can read more about this in my blog post here =>Macro Mondays – How To Assign An Excel Macro To A Button or Assign A Button To An Excel Macro.
  3. Finally, can also run the macro directly from the Developer Tab. Developer Tab | Code Group | Run Macro | Select your macro.

 

 

What Next? Want More Tips?

So, if you want more tips then sign up for my Monthly Newsletter where I share 3 Tips on the first Wednesday of the month and receive my free Ebook, 30 Excel Tips.

1If you want to see all of the blog posts in the Macro Monday series. Click on the link below

How To Excel At Excel – Macro Mondays Blog Posts.

 

Learn Excel With Our Excel Online Courses

Do You Need Help With An Excel Problem?.

Finally, I am pleased to announce I have teamed up with Excel Rescue, where you can get help FAST. All you need to do is choose the Excel task that most closely describes what you need to be done. Above all, there is a money back guarantee and similarly Security and Non-Disclosure Agreements. Try It!. Need Help With An Excel VBA Macro?. Of course, you don’t need to ask how to list all files in a directory as it is right here for free.

 

ExcelRescue.net

Udemy.com Home page 125x125

Barbara

Barbara is an experienced data analyst with over 20 years of experience. Author of the How To Excel At Excel Top 50 Excel tips Ebook, YouTuber and Excel Blogger.

Recent Posts