VBA (Visual Basic for Application) Macro in
Excel.
Let’s write your first macro, it’s very useful feature of
Excel by using it you can automate reports or any repetitive work done in
excel. Before writing macro need to check if you have Developer tab enabled or
not if no then right click on excel ribbon and select customize the Ribbon… then
check in Developer tab option and click ‘Ok’ now you will be able to see
developer tab in your ribbon.
After you add Developer tab you can explore the new world of
excel. Automate daily reports, all repeat tasks and save your valuable time.
You don’t know VBA language?
Don’t worry Excel will write code (VBA module) for you. Yes by using ‘Record Macro’ option you can record the steps and use it whenever you want.
Don’t worry Excel will write code (VBA module) for you. Yes by using ‘Record Macro’ option you can record the steps and use it whenever you want.
Here is the example write numbers in column A and the result
in Column C as shown below. Once this is done activate Macro Recorder (make sure you will avoid unnecessary clicks and
moves as it will record each and every click and activity you do while
recording) Name macro as Calculate.
Write all formulas in column D as mentioned below after that
stop recording. As shown in below.
Sum
|
=Sum(A2:A11)
|
Average
|
=AVERAGE(A2:A11)
|
Count
|
=COUNT(A2:A11)
|
Max
|
=MAX(A2:A11)
|
Min
|
=MIN(A2:A11)
|
Your first code…
When you click on record macro from that step excel will
create new module and start writing VBA coding in it.
Next step is add form button to run recorded code
whenever you want.
Click on Developer tab >> insert >> form button >> assign macro
Click on Developer tab >> insert >> form button >> assign macro
Your first VBA macro is complete.
So even if you don’t know VBA coding language you can
record and use it.
Note: while saving this file select option for macro enabled file (.xlsm).
Hope you like this
Please use comment section to provide your feedback or to
ask questions.
No comments:
Post a Comment