about writing macro in VBA editor to calculate the total of salary and
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 Visual Basic Editor.
In the Visual Basic editor window, select 'Insert'
Start writing your code as demonstrated.
First we write the name of the macro myMacro()
Next we access cell address C2 and assign it
value of B2 (salary).
We access D2 and assign it the value of sum of C2 and
In this manner the total salary package is calculated.
The idea is to
learn how to create macros using the VBA editor.