Wednesday, December 29, 2010

The difference between recorded macros and VBA scripts

Although the difference lies mainly in how the script is being generated your results can be impacted dramatically.

Recorded Macros - When a macro is recorded you will often create a substantial amount of code that is completely unnecessary (ie. scroll downs).  This is often the most simplest method to create automation.  You simply click tools, then macros then record macros as shown here:

You can then follow the steps you normally take and it will record every move you make in Excel.  Once you click the stop button the macro will be available for repeating these exact steps whenever you need!

VBA scripts - Using effective VBA scripts allows you to eliminate unnecessary steps which improves your speed.  This becomes a very important factor as you add more steps, apply to growing data sets, or when multiple functions are involved.  Remember, your computer has to walk through each step in your script so keeping it short is key.

No comments: