Documente Academic
Documente Profesional
Documente Cultură
(https://www.guru99.com/)
What is a macro?
The importance of macros in Excel
What is VBA in a layman's language?
Macro Basics
Step by step example of recording macros in Excel
What is a macro?
A macro is a piece of programming code that runs in Excel environment and helps automate
routine tasks. In a layman's language, a macro is a recording of your routine steps in Excel
that you can replay using a single button.
https://www.guru99.com/introduction-to-macros-in-excel.html 1/15
You can import the data into Excel and
4/2/2019
format. The following day you will be required to
How to Write Macros in Excel: Step by Step Tutorial
perform the same ritual. It will soon become boring and tedious. Macros solve such
problems by automating such routine tasks. You can use a macro to record the steps of
Macro Basics
Macros are one of the developer features. By default, the tab for developers is not displayed
in excel. You will need to display it via customize report
Macros can be used to compromise your system by attackers. By default, they are disabled
in excel. If you need to run macros, you will need to enable running macros and only run
macros that you know come from a trusted source
If you want to save macros, then you must save your workbook in a macro-enabled format
*.xlsm
Always fill in the description of the macro when creating one. This will help you and others
to understand what the macro is doing.
(/images/5-2015/050215_1033_Introductio111.png)
https://www.guru99.com/introduction-to-macros-in-excel.html 2/15
You can download the above file here
4/2/2019 How to Write Macros in Excel: Step by Step Tutorial
We will create a macro enabled template that will import the above data and format it to
meet our business reporting requirements.
(/images/vba/062416_1048_WhatisVBA1.png)
")}c(a)});}).call(this);
Step 2) Select "Options" from the menu list as shown in screen shot below.
https://www.guru99.com/introduction-to-macros-in-excel.html 3/15
4/2/2019 How to Write Macros in Excel: Step by Step Tutorial
(/images/vba/062416_1048_WhatisVBA2.png)
Step 3) Now another window will open, in that window do following things
https://www.guru99.com/introduction-to-macros-in-excel.html 4/15
4/2/2019 How to Write Macros in Excel: Step by Step Tutorial
(/images/vba/062416_1048_WhatisVBA3.png)
Step 4) You will now be able to see the DEVELOPER tab in the ribbon
(/images/vba/062416_1048_WhatisVBA4.jpg)
First, we will see how we can create a command button on the spreadsheet and execute the
program.
(/images/5-2015/050215_1033_Introductio3.png)
https://www.guru99.com/introduction-to-macros-in-excel.html 5/15
1. Click on the DEVELOPER tab
4/2/2019 How to Write Macros in Excel: Step by Step Tutorial
(/images/5-2015/050215_1033_Introductio4.png)
(/images/5-
2015/050215_1033_Introductio5.png)
https://www.guru99.com/introduction-to-macros-in-excel.html 6/15
4/2/2019 How to Write Macros in Excel: Step by Step Tutorial
(/images/5-2015/050215_1033_Introductio6.png)
Go to the local drive where you have stored the CSV file
Select the CSV file
Click on Import button
(/images/5-
2015/050215_1033_Introductio7.png)
https://www.guru99.com/introduction-to-macros-in-excel.html 7/15
Click on Next button after followingHow
4/2/2019
thetoabove steps
Write Macros in Excel: Step by Step Tutorial
(/images/5-
2015/050215_1033_Introductio8.png)
(/images/5-
2015/050215_1033_Introductio9.png)
https://www.guru99.com/introduction-to-macros-in-excel.html 8/15
4/2/2019
Click on Finish button How to Write Macros in Excel: Step by Step Tutorial
(/images/5-
2015/050215_1033_Introductio10.png)
Make the columns bold, add the grand total and use the SUM function to get the total
amount.
(/images/5-
2015/050215_1033_Introductio11.png)
Now that we have finished our routine work, we can click on stop recording macro button as
shown in the image below
(/images/5-2015/050215_1033_Introductio12.png)
https://www.guru99.com/introduction-to-macros-in-excel.html 9/15
Before we save our work book, we will
4/2/2019
need to delete the imported data. We will do this to
How to Write Macros in Excel: Step by Step Tutorial
create a template that we will be copying every time we have new receipts and want to run
the ImportBankReceipts macro.
(/images/5-2015/050215_1033_Introductio13.png)
https://www.guru99.com/introduction-to-macros-in-excel.html 10/15
4/2/2019 How to Write Macros in Excel: Step by Step Tutorial
(/images/5-
2015/050215_1033_Introductio14.png)
1. Select ImportBankReceipts
2. Highlights the description of your macro
3. Click on Run button
")}c(a)});}).call(this);
(/images/5-
2015/050215_1033_Introductio15.png)
Summary
https://www.guru99.com/introduction-to-macros-in-excel.html 11/15
Macros simplify our work lives by automating
4/2/2019
most of the routine works that we do. Macros
How to Write Macros in Excel: Step by Step Tutorial
Next (/creating-your-first-visual-basic-for-applications-vba-in-excel.html)
")}c(a)});}).call(this);
https://www.guru99.com/introduction-to-macros-in-excel.html 12/15
4/2/2019 How to Write Macros in Excel: Step by Step Tutorial
VBA Tutorial
1) How to Write Macros in Excel (/introduction-to-macros-in-excel.html)
https://www.guru99.com/introduction-to-macros-in-excel.html 13/15
4/2/2019 How to Write Macros in Excel: Step by Step Tutorial
(https://www.facebook.com/guru99com/)
(https://twitter.com/guru99com)
(https://www.youtube.com/channel/UC19i1XD6k88KqHlET8atqFQ)
(https://forms.aweber.com/form/46/724807646.htm)
About
About Us (/about-us.html)
Advertise with Us (/advertise-us.html)
Write For Us (/become-an-instructor.html)
Contact Us (/contact-us.html)
Career Suggestion
SAP Career Suggestion Tool (/best-sap-module.html)
Software Testing as a Career (/software-testing-career-
complete-guide.html)
Certificates (/certificate-it-professional.html)
Interesting
Books to Read! (/books.html)
Blog (/blog/)
Quiz (/tests.html)
eBook (/ebook-pdf.html)
Execute online
Execute Java Online (/try-java-editor.html)
Execute Javascript (/execute-javascript-online.html)
https://www.guru99.com/introduction-to-macros-in-excel.html 14/15
4/2/2019
Execute HTML (/execute-html-online.html)
How to Write Macros in Excel: Step by Step Tutorial
https://www.guru99.com/introduction-to-macros-in-excel.html 15/15