Intro to Excel 2010 VB Editor
Under Tools, Options, Editor, you will find several useful settings. All settings except for one are correctly set by default. The rest of the setting requires some thought on your part. This setting is Require Variable Declaration. By default, Excel does not require you to declare variables. This setting can save time when you create a program. Some may prefer to change this setting to require variable declaration. Changing this setting forces the compiler to stop if it finds a variable that it does not recognize, thus reducing misspelled variable names. Turning this setting on or keep it off depends on personal preference.
Project Explorer Window
The Project Explorer lists any open workbooks and add-ins that are loaded. If you click the + icon next to the VBA Project, you will see that there is a folder with Microsoft Excel objects. There can also be folders for forms, class modules, and standard modules. Each folder includes one or more individual components. Right-click a component and select View Code or just double-click the components will bring up any code in the Programming window. The exception is userforms. Double-clicking displays the userform in Design view. To display the Project Explorer window, select View, Project Explorer from the menu, and press Ctrl+R or click the Project Explorer icon on the toolbar.
To insert a module, right-click your project, select Insert, and then choose the type of module you want.
Available modules:
Microsoft Excel objects
By default, a project consists of sheet modules for each sheet in the workbook and a single ThisWorkbook module. Code specific to a sheet such as controls or sheet events is placed on the corresponding sheet. Workbook events are placed in the ThisWorkbook module.
Forms
Excel allows you to design your own forms to interact with the user.
Modules
When you record a macro, Excel automatically creates a module in which to place the code. Most of your code will be located in in these types of modules.
Class modules
Class modules are Excel’s way of letting you create your own objects. They allow pieces of code to be shared among programmers without the programmer needing to understand how it works.
