Читать книгу Excel Macros For Dummies - Dick Kusleika - Страница 49
The Require Variable Declaration option
ОглавлениеIf the Require Variable Declaration option is set, VBE inserts the following statements at the beginning of each new VBA module you insert:
Option Explicit
Changing this setting affects only new modules, not existing modules. If this statement appears in your module, you must explicitly define each variable you use. Using a Dim statement is one way to declare variables.
If you don't set this option, VBA won't require you to explicitly declare your variables. If you don't declare a variable, VBA will declare it for you the first you use it. That is, VBA will create a spot in memory with that variable's name. That may seem like a time saver, but the first time you mistype a variable, you'll be glad you required variable declaration. Bugs from misspelled variables can be hard to find.