Visual Basic for Applications (VBA)

Helpful macros for a variety of business applications

VBA is the back-end programming language of Microsoft Excel and other Microsoft Office programs.

It is important to ensure that our Microsoft Excel package has the Developer Tab added onto it.

This step is NOT mandatory for entering the visual basic editor, but is necessary if you are recording macros to automate various processes.

If you are just writing code (i.e. coding a function), you can enter the VBA environment simply by pressing ALT + F11 on your keyboard.

  1. Click on “File.”
  2. Click on “Options.”
  3. Click on “Customize Ribbon.”
  4. Make Sure there is a check mark next to “Developer.”

We want to ensure that we are looking at the correct VBA Project. The project name is the name of the Excel File that you are working within. In this case, it is called: “VBA Tutorial.xlsx.”

You may select any sheet listed on the left-hand pane if you wish to insert a VBA script only pertaining to that sheet. However, if you wish to operate the script on the entire Excel workbook, then you should select "ThisWorkbook" from that respective pane.

In any event, VBA script is inserted into what is called a "module." So, to insert a module, simply click on "Insert" followed by "Module" from the top menu.

Notice the Module now appears in the pane on the left-hand side. Moreover, you may now begin to write sub procedures in the empty space provided in the window on the right-hand side. You may write your own script here or copy and paste those that have already been provided to you.