Forcing Yourself to Declare All Variables

Declaring every variable that you use in your code is an excellent practice. For example, if you use an integer variable named Count, declare it as Dim Count as Integer.

Declaring your variables as a particular data type makes your code run faster and also helps avoid typographical errors. To force yourself to declare all variables, insert the following statement at the top of your module:

Option Explicit

If you would like this statement automatically added to each new module, follow these steps:

0 0

Responses

Post a comment