A procedure in VBA is a set of codes or a single line of code that performs a specific activity. SUB: Sub procedure can perform actions but doesn’t return a value (but you can use an object to get that value). Function: With the help of the Function procedure, you create your function, which you can use in the worksheet or the other SUB and FUNCTION procedures (See this: VBA Function). 2. Variables and Constants You need variables and constants to use values in the code multiple times. Variable: A Variable can store a value, it has a name, you need to define its data type, and you can change the value it stores. As the name suggests, “VARIABLE” has no fixed value. It is like a storage box that is stored in the system. Constant:‌ A constant also can store a value, but you can’t change the value during the execution of the code. 3. Data Types You need to declare the data type for VARIABLES and CONSTANTS. When you specify the data type for a variable or a constant, it ensures the validity of your data. If you omit the data type, VBA applies the Variant data type to your variable (it’s the most flexible), VBA won’t guess what the data type should be. Tip: VBA Option Explicit 4. Objects, Properties, and Methods Visual Basic for Applications is an Object-Oriented language, and to make the best out of it; you need to understand Excel Objects. The workbook you use in Excel has different objects, and with all those objects, there are several properties that you can access and methods that you can use. 5. Events Whenever you do something in Excel, that’s an event: enter a value in a cell, insert a new worksheet, or insert a chart. Below is the classification of events based on the objects: Application Events: These are events that are associated with the Excel application itself. Workbook Events: These are events that are associated with the actions that happen in a workbook. Worksheet Events: These events are associated with the action that happens in a worksheet. Chart Events: These events are associated with the chart sheets (which are different from worksheets). Userform Events: These events are associated with the action that happens with a user form. OnTime Events: OnTime events are those which can trigger code at a particular point in time. OnKey Events: OnKey events are those which can trigger code when a particular key is pressed. 6. Range The range object is the most common and popular way to refer to a range in your VBA codes. You need to refer to the cell address, let me tell you the syntax. Worksheets(“Sheet1”).Range(“A1”) 7. Conditions Just like any other programming language, you can also write codes to test conditions in VBA. It allows you to do it in two different ways. IF THEN‌ ELSE‌: It’s an IF statement that you can use to test a condition and then run a line of code if that condition is TRUE. You can also write nesting conditions with it SELEC‌T‌ CASE: In the select case, you can specify a condition and then different cases for outcomes to test to run different lines of code to run. It’s a little more structured than the IF statement. 8. VBA Loops You can write codes that can repeat and re-repeat an action in VBA, and there are multiple ways that you can use to write code like this. For Next: The best fit for using For Next is when you want to repeat a set of actions a fixed number of times. For Each Next: It’s perfect to use when you want to loop through a group of objects from a collection of objects. Do While Loop: The simple idea behind the Do While Loop is to perform an activity while a condition is true. Do Until Loop: In the Do Until, VBA runs a loop and continues to run it if the condition is FALSE. 9. Input Box and Message Box Input Box: The input Box is a function that shows an input box to the user and collects a response. Message Box: Message Box helps you show a message to the user but, you have an option to add buttons to the message box to get the response of the user. 10. Errors Excel has no luck when it comes to programming errors, and you have to deal with them, no matter what. Syntax Errors: It’s like typos that you do while writing codes, but VBA can help you by pointing out these errors. Compile Errors: It comes when you write code to perform an activity, but that activity is not valid. Runtime Errors: A RUNTIME error occurs at the time of executing the code. It stops the code and shows you the error dialog box. Logical Error: It’s not an error but a mistake while writing code and sometimes can give you nuts while finding and correcting them.