Excel Macro Tutorial
Looking for an Excel macro tutorial? As I expanded my knowledge of Excel in my finance career, I began to run
across a variety of tasks that I did over and over in Excel. Luckily, Excel includes a wonderful solution for
automating your work – the creation of macros.
What is a Macro?
A macro is a set of step-by-step instructions that Excel can follow without requiring any input from the user.
Once a macro has been created, you can run it and Excel will follow the exact steps you included when the macro was
developed. This is a great time saver for those tedious tasks that you perform hundreds of times in your job but
which really require little thought.
Recorded Macros
The easiest way to create a macro in excel is to record it. You simply turn on the macro recorder and begin
performing the steps you want to automate. When you have completed the steps in your repetitive process, you just
stop recording and your macro is ready to go!
Recorded macros are great for when you perform an identical set of steps on a worksheet – as long as the data
you are working on is in the same cells as it was when you recorded the macro, your results will come out exactly
as if you were doing the work yourself. But, what if you want to perform repetitive work on a range of data that is
not always the same size? For this you will need to learn how to change the underlying VBA code in the macro.
Editing the VBA Code of a Recorded Macro
As you record your macro, Excel is writing the instructions for your step by step process in the background
using VBA code. Once your macro is done recording, the code is ready for you to edit. Editing the VBA is not
difficult once you understand the basic concepts and syntax of the VBA language.
The great thing about editing your VBA macro by hand is that you will be able to include more advanced logic
such as variables and loops – this allows you to tell Excel to perform a certain type of action on a range of data
even if it is not identical to the range you used for recording the macro.
Obviously a full treatment of VBA requires more a good deal more material than a simple article can provide. For
more information on writing your own VBA macros and to learn how to program your Excel worksheets for maximum
performance and flexibility, spend some time with a good video tutorial.
|