We are excited and happy to announce our revised edition of book – VBA For Excel by Hirdesh Bhardwaj, recently launched online @ Amazon, Flipkart and other 44 international channels. Here is the quick summary of revised edition of the same.
No. of Pages : 192
1st Edition : Nov 2016.
Revised Edition : Oct 2017
Publisher(s) : Educreation, Ebooks2go
ISBN : 978-1618134806
What is a macro?
A macro is a set of code that runs in Office Application and help us to automate tasks that we frequently use in corporate world.
Let’s assume I should prepare a report in Excel and as for this I need to use content of many worksheets. In making a report, I generally use the following steps which are:
-Open desired worksheet
-Make selection of the data
-Use Auto Filter and other relevant task
-Copy the desired data after sorting and filtering
-Now Open another workbook / worksheet to paste selected data for making dashboard
I use all the steps above for so many times to prepare reports on daily basis data. As you noticed, the steps above is more likely consuming amount of time and therefore, I use macro to automate the same task in a single click.
While you are writing the code, you should have a clear idea of what it does and how it works otherwise your macro may stuck and your entire work may interrupt. Hence, VBA Macro is the best solution for the steps above.
So in short, a macro is a recording or capturing of your task step by step you takes in Excel that you can follow by using a single button..
What is VBA?
You recently aware with macros. So now let’s get to know more with another term called “VBA- Visual Basic for Applications”.
VBA is a programming language, developed by Microsoft. Before you think about the programming language, it is essential to know that programming languages are used to communicate with your computer and not to human. Therefore, VBA is a tool to communicate and passes your instructions to Excel.
However, macro is not a programming language. As explained by John Walkenbach (one of the most popular author)
“A macro is a sequence of instructions that automates some aspect of Excel.”
What Are Sub Procedures?
A procedure is defined as a named group of statements that are run as a unit.
In short, a Sub procedure is something which contain set of lines of your VBA codes
As you know if you are going to complete a task in excel, then you need lot of actions required to complete the task. To accomplish the same task through VBA you need to write many lines. If you are going to compile those lines one by one manually then what is the difference of using Excel and VBA? Actually you wanted to bind and automate the whole task with single click, then you need to wrap or put all related VBA lines in a group called procedure.
So here is your sample sub procedure goes something like this-
Msgbox “Hello World !!! “
Variable in VBA
Just consider if you have to store a contact number in your phone book then what steps you follow to store the same?
-You create a new contact and name it Like Mr. X.
-You enter his contact number like +91-XX-XXX-XXX in Phone field.
Whenever you need a call to Mr. X, you need not to dial his number, you simply browse your contact list and click to call on Mr. X entry. So here Mr. X is the name of the variable you assigned and his contact number +91-XX-XXX-XXX is the variable value.
So the variable is something to store information, you use frequently in your program.