VBA basics
5. VBE Set Options (Option Explicit)

Excel macro basics and applications, introduction to Excel VBA
last updated:08-13-2019

5. VBE Set Options (Option Explicit)

Some of this topic was processed by machine translation. Original


There are some options that should be set a little before you start writing macros.


No, it's a VBE Set Options that must be set.
Be sure to set it first.

VBE "Tools" → "Options"

VBA macro Excel

The following screen will appear.

VBA macro Excel


Initially,
“Automatic syntax check” has a check (check mark), so please remove the check.
* In Excel2013 and later, the check is removed from the beginning.
And “Force variable declaration” is not checked, so check it.

There is no problem in the “Editor Settings”.

VBA macro Excel

There is no problem even if you fix it, but it is better to keep it around the font size.

Please do not fix in “General”.

VBA macro Excel


The changes here will affect the behavior itself,
Please do not change it unless you understand 100% of the meaning of Japanese.

It's better not to change the "docking".

VBA macro Excel

If you get used to the screen operation of VBE and want to change it to make it easier to use, please review it.
However, I usually do not need to change it, I use it as it is.

Insert new module

Let's insert a new module.

VBA macro Excel

Unlike before setting options,
This time, “Option Explicit” is added at the top.
This corresponds to “force variable declaration”.
The meaning of this will be explained in detail later in the variable declaration.



Articles with the same theme "VBA basics"

2. First Prepare to use Macro VBA
3. Macro recording
4. Where is the macro written (VBE startup)
5. VBE Set Options (Option Explicit)
6. Let's write it anyway (Sub, End Sub)
7. To run a macro (F5)
8. What is putting a character in a cell (Range, Value)
9. How to specify cells in Range
10. Specification method other than Range (Cells, Rows, Columns)
11. How to use Range and Cells
12. Variables and data types (Dim)



  • >
  • >
  • 5. VBE Set Options (Option Explicit)

  • If you find this site useful, please share and bookmark.


    I'm going to pay close attention to the description,
    If you have any mistakes or suggestions,「Contact Us」I hope you will let me know.
    Use the posted VBA code at your own risk.
    We are not liable for any damages such as data corruption.




    If you find this site useful, please share and bookmark.
    To the bottom of the text