The difference

Actually there is no difference between macro code and VBA code. But, there is a “but”. For one, a Macro-code consists of a lot more lines of code than a VBA code, and this may cause some delays when executing large Excel files.

This difference is clear.

At the top is the macro code (1), the bottom is the VBA code (2).
Both do exactly the same thing. They select column A in the worksheet, make the cells bold and centered, applying the “Verdana” font with a size of 12 pixels.

The macro code (1) has a lot of rows. The VBA code (2) has just five.

les14_image001_en

The reason why we add so many lines of code to a macro is actually simple. A Macro runs on almost all possible settings (A) that can be set for a particular option.

As you can see in the example, the Macro contains code for strikeout, super script and subscript (B) which you do not really need in this case. As such, the values for those variables are set as “False” in the Macro, but you do have the unnecessary lines of code.

les14_image002_en

Also, although we can use macros for a lot of tasks, there is limited control over when and how those tasks are performed, plus the imposition of conditions may be difficult, if not impossible.

Conclusion:

If you use lots of macros in your spreadsheet, and I mean tons of them, or you take certain actions that are not possible with macros, learn VBA. Otherwise do not bother. The choice is yours.

Awesome!
You've completed Lesson 14
START NEXT LESSON