After reviewing the VBA Orientation, we are now ready to set up our development environment. By the end of this section, you’ll have navigated to and set up your IDE, made an important configuration, and created your firt module.
Steps
-
Open an Excel workbook (easy enough!)
-
Navigate to the File tab
-
Select Options
-
Select Customize Ribbon, then enable the Developer Tab and click OK
-
After completing the previous step, you should be able to see a new tab in your Excel workbook titled Developer
-
Navigate to the Developer tab, then click the Visual Basic button in the ribbon
-
You should see an IDE screen that appears like this (or something similar)
-
Within the IDE navigation bar, click Tools > Options
-
Once the Options Toolbox opens up, select Require Variable Declarations. After you have enabled Require Variable Declarations, select OK. This will require that you declare all your variables going forward (more on this later), and this rule will apply to all Modules going forward. If this step was completed successfully, you should see the words Option Explicit on the top of every module you open. This might not make sense now, but it is a configuration I want you to set and I’ll explain why and what it does in a later post.
-
Navigate to Insert in the IDE navigation bar and select Module. This is where you will type code!! We did it!!
You’ll notice in the left hand navigation pane there is a new directory with a module in it. You’ll see where you can rename the module to something more meaningful to you and your project, and you’ll also see a blank white IDE with the words Option Explicit near the top as discussed in step 9.
Quick launch of the IDE
You could skip steps 2 - 7 with a simple shortcut key, ALT + F11. Pressing ALT+F11 will pull up your IDE screen. You’ll still want to do steps 8 - 10 if it’s your first time loading up your IDE. Every subsequent time you can simply press ALT + F11, insert a module, and go straight to coding.
What you’ve accomplished
- Set up the Developer Tab
- Opened your IDE
- Configured your IDE to require variable declarations
- Learned how to insert a module where you can begin to write code
What’s next?
You are now ready to create your first program in VBA. Let’s do it!
Navigation