The efficient way to add multiple variables

The Variable Builder included in Code VBA is one of the tools that make specifying variables very easy and efficient.
- If inside a procedure, you can indicate if you want the variable to appear at the cursor position or at the top of the procedure. The latter is useful in procedures with many variables where you want to be able to see them all together, possibly to check if you did not use different variables for the same thing;
- If you want to declare multiple variables in one go it can do so using the Insert button which keeps the variable builder dialog open;
- Chose to have default explicitly set (False in case of Boolean, "" for String, 0 for numerics);
- You can switch from standard VBA types to select from types in the current Office application (here Excel).
Clipboard: All variable insertion tools copy the new variable to the clipboard,
this making it available for direct use.
Add variables to module header

You can also add variables to module header. You then can set the scope:
- Public: also available to other modules.
- Private: availability limited to the current module.
If no scope is set, Visual Basic assumes Public.
Warning
Avoid module level variables in standard modules as there is no way to control it's value being unexpectedly changed by another procedure. Use of Private variables in classes is not a problem, actually in there these are the standard mechanism to store values of properties - see Property Builder.
Avoid module level variables in standard modules as there is no way to control it's value being unexpectedly changed by another procedure. Use of Private variables in classes is not a problem, actually in there these are the standard mechanism to store values of properties - see Property Builder.