Another
example
about writing macro in VBA editor to calculate the total of salary and
perks.
To write a macro in Microsoft Excel you need a knowledge of the
programming language Visual Basic for Applications(VBA). VBA is easy to
learn and gives you a powerful tool to automate your work in Microsoft
Excel. Also you can create new applications in Microsoft Excel if you
can write macros. Practice will make you perfect.
Click on Tools in the menu bar.
Select Macro.
Select Visual Basic Editor.
In the Visual Basic editor window, select 'Insert'
from
menu bar.
Select Module.
Start writing your code as demonstrated.
First we write the name of the macro myMacro()
Next we access cell address C2 and assign it
the
value of B2 (salary).
We access D2 and assign it the value of sum of C2 and
B2.
In this manner the total salary package is calculated.
The idea is to
practice and
learn how to create macros using the VBA editor.