Microsoft Office Development and Consultancy
|Excel > Macros > Getting Started||| Next >|
What is a Macro ?
A macro is just the name given to a sequence of instructions (or keystrokes) that can be recorded and then played back in order to automate a task.
These keystrokes are then transferred into a series of commands which can then be rerun at any time.
Macros are simple computer programs where the code is often generated for you.
These macros run completely within Excel and require no additional software.
They can be used to play back your actions and can prevent you from having to perform tedious or repetitive tasks.
Macros can perform specific tasks a lot quicker than they can be done manually and often with greater accuracy.
Automating frequently performed tasks will save you a lot of time and will make you more productive.
Most spreadsheet packages have the facility to let you record your own macros.
What can a Macro do ?
Any task that can be performed manually using the keyboard or mouse, a macro could do.
Using macros enables you to perform repeated tasks much more efficiently than performing individual steps over and over again.
Macros are ideal for performing the same task to several cells, worksheets or even workbooks.
They are commonly used to apply formatting and for entering large amounts of data.
Macros can also be interactive, requesting information from the user and then taking actions depending on the information obtained.
All you need to do is record your actions the first time you perform the task and then just rerun the macro for all the other times.
A macro can even enter data into a worksheet that is hidden from view.
How can I create a Macro ?
There are two ways to create a macro. You can either use the Macro Recorder or you can write the commands directly using the Visual Basic Editor.
The Macro Recorder records all your keystrokes (i.e. each individual button pressed) and generates the corresponding VBA code in order to re-create the steps.
Using the Macro Recorder is the easiest way to quickly automate your tasks and this tool is very easy to use.
The Macro Recorder is a simple way to perform tasks quickly without actually coming into contact with any code.
Regardless of the method used all the macros are written in VBA.
Once you create a macro you can either run it, modify it or delete it.
What is VBA ?
The term VBA is short for Visual Basic for Applications and is the name of the programming language used to represent the commands.
It is possible to write very complicated macros although these are generally written by dedicated programmers using the Visual Basic Editor window.
This window provides a dedicated environment where you can edit and write VBA code. This window can be displayed by selecting (Tools > Macro > Visual Basic Editor).
It looks very much like a separate application and will appear as an additional window on your status bar.
You can modify all the macros which you create with the Macro Recorder using the Visual Basic Editor window.
The Visual Basic Editor window comes as standard in the majority of the Microsoft Office applications.
|© Better Solutions Limited 06-Dec-2013||Top | Next >|