What is VBA? • VBA stands for Visual Basic for Applications. It is a combination of the Microsoft's event-driven programming language Visual Basic with Microsoft Office Applications such as Microsoft Excel. • VBA enables you to automate various activities in Excel like generating reports, preparing charts & graphs, doing calculations, etc. This automation activity is also often referred as Macro. This way it helps users to save their time spent behind running the repetitive steps.
Uses of VBA Personal & Business Applications of VBA in Excel • For personal use, you can use it for simple macros that will automate most of your routine tasks. • For business use, you can create complete powerful programs powered by excel and VBA. The advantage of this approach is you can leverage the powerful features of excel in your own custom programs. • Analyze huge amounts of data • Finance professionals, such as portfolio managers, financial analysts, traders, and investment bankers often need to deal with large volumes of data.
Create and maintain complex models • Finance professionals can also use VBA to create trading, pricing, and risk management models. Create investment scenarios • Investment bankers and financial analysts often need to make decisions by comparing two or more investment scenarios. For example, in mergers and acquisitions, finance professionals must consider the financial impact of the merger to determine if it is feasible.
Basics of VBA Variable –where x = 1 and y = 3. In this expression, x and y are variables. They can be assigned any numbers i.e. 1 and 3 respective as in this example. Variables in short are memory locations. Rules for creating variables • Don't use reserved words • Variable names cannot contain spaces • Use descriptive names
 Arithmetic operators - The rules of Brackets of Division Multiplication Addition and Subtraction (BODMAS) apply so remember to apply them when working with expressions that use multiple different arithmetic operators. Just like in excel, you can use o + for addition o - for subtraction o * for multiplication o / for division.
Logical operators – These include o If statements o OR o NOT o AND o TRUE o FALSE •
Step by Step process to enable the Developer tab The step by step process on how to enable the developer tab in Excel: • Create a new workbook • Click on the ribbon start button • Select options • Click on customize ribbon • Select the developer checkbox as shown in the image below • Click OK
• Enable Developer Option • To execute VBA program, you have to have access to developer Excel. Enable the developer option as shown in the below Excel example and pin it into your main ribbon in Excel. • Step 1)Go to main menu "FILE" • Select option "Options."
• Step 2) Now another window will open, in that window do following things • Click on Customize Ribbon • Mark the checker box for Developer option • Click on OK button
• Step 3) Developer Tab • You will now be able to see the DEVELOPER tab in the ribbon
• Step 4 − Click the 'Visual Basic' button to open the VBA Editor.
• Step 5 − Start scripting by adding a button. Click Insert → Select the button.
• Step 6 − Perform a right-click and choose 'properties'.
• Step 7 − Edit the name and caption as shown in the following screenshot.
Step 8 − Now double-click the button and the sub-procedure outline will be displayed as shown in the following screenshot.
• Step 9 − Start coding by simply adding a message. • Step 10 − Click the button to execute the sub-procedure. The output of the sub-procedure is shown in the following screenshot. Make sure that you do have design mode turned on. Simply click it to turn it on if it is not on.

Unit ii introduction to vba

  • 1.
    What is VBA? •VBA stands for Visual Basic for Applications. It is a combination of the Microsoft's event-driven programming language Visual Basic with Microsoft Office Applications such as Microsoft Excel. • VBA enables you to automate various activities in Excel like generating reports, preparing charts & graphs, doing calculations, etc. This automation activity is also often referred as Macro. This way it helps users to save their time spent behind running the repetitive steps.
  • 2.
    Uses of VBA Personal& Business Applications of VBA in Excel • For personal use, you can use it for simple macros that will automate most of your routine tasks. • For business use, you can create complete powerful programs powered by excel and VBA. The advantage of this approach is you can leverage the powerful features of excel in your own custom programs. • Analyze huge amounts of data • Finance professionals, such as portfolio managers, financial analysts, traders, and investment bankers often need to deal with large volumes of data.
  • 3.
    Create and maintaincomplex models • Finance professionals can also use VBA to create trading, pricing, and risk management models. Create investment scenarios • Investment bankers and financial analysts often need to make decisions by comparing two or more investment scenarios. For example, in mergers and acquisitions, finance professionals must consider the financial impact of the merger to determine if it is feasible.
  • 4.
    Basics of VBA Variable–where x = 1 and y = 3. In this expression, x and y are variables. They can be assigned any numbers i.e. 1 and 3 respective as in this example. Variables in short are memory locations. Rules for creating variables • Don't use reserved words • Variable names cannot contain spaces • Use descriptive names
  • 5.
     Arithmetic operators- The rules of Brackets of Division Multiplication Addition and Subtraction (BODMAS) apply so remember to apply them when working with expressions that use multiple different arithmetic operators. Just like in excel, you can use o + for addition o - for subtraction o * for multiplication o / for division.
  • 6.
    Logical operators – Theseinclude o If statements o OR o NOT o AND o TRUE o FALSE •
  • 7.
    Step by Stepprocess to enable the Developer tab The step by step process on how to enable the developer tab in Excel: • Create a new workbook • Click on the ribbon start button • Select options • Click on customize ribbon • Select the developer checkbox as shown in the image below • Click OK
  • 8.
    • Enable DeveloperOption • To execute VBA program, you have to have access to developer Excel. Enable the developer option as shown in the below Excel example and pin it into your main ribbon in Excel. • Step 1)Go to main menu "FILE" • Select option "Options."
  • 10.
    • Step 2)Now another window will open, in that window do following things • Click on Customize Ribbon • Mark the checker box for Developer option • Click on OK button
  • 12.
    • Step 3)Developer Tab • You will now be able to see the DEVELOPER tab in the ribbon
  • 13.
    • Step 4− Click the 'Visual Basic' button to open the VBA Editor.
  • 14.
    • Step 5− Start scripting by adding a button. Click Insert → Select the button.
  • 15.
    • Step 6− Perform a right-click and choose 'properties'.
  • 16.
    • Step 7− Edit the name and caption as shown in the following screenshot.
  • 17.
    Step 8 −Now double-click the button and the sub-procedure outline will be displayed as shown in the following screenshot.
  • 18.
    • Step 9− Start coding by simply adding a message. • Step 10 − Click the button to execute the sub-procedure. The output of the sub-procedure is shown in the following screenshot. Make sure that you do have design mode turned on. Simply click it to turn it on if it is not on.