VBA basics
4. Where is the macro written (VBE startup)

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

4. Where is the macro written (VBE startup)

Some of this topic was processed by machine translation. Original

So where do you write your macros?

First of all, an edit screen equivalent to paper for writing macros is displayed.

This macro editing screen is called Visual Basic Editor, VBE for short.

How to display "Visual Basic Editor"

Excel2007, Excel2010 or later
"Development"-> "Visual Basic" on the ribbon
"Tool"-> "Macro"-> "Visual Basic Editor"

In all versions, the shortcut is
Alt + F11
This screen is displayed.

VBA macro excel

This is the Visual Basic Editor

For short, this is a screen called VBE.

The part displayed on the left is called the project window.

In this state, only the sheet is displayed.
At the bottom, "ThisWorkbook", don't worry about this now.

I will explain when it is time to use it.

There is still no place to write macros here.
The place to write macro VBA is called standard module.

Let's insert a standard module.

Insert standard module

Menu "Insert"-> "Module" ... Alt + I + M

VBA macro excel

Right click in the project and select "Insert"-> "Standard Module"

VBA macro excel

Now it looks like this.

VBA macro excel

The white background on the right is where to write the macro.

And on the left side, “Standard Module” is added,
Below that, “Module1” is added.

In other words, write a macro in the standard module Module1.

Rename "Module1"

The name “Module1” is the name given by VBE without permission.

You can insert any number of standard modules,
In order, "Module1" and "Module2" are serial numbers.

If you want to change this name, do so in the Properties window.

When the property window is not displayed,
View → Properties window

VBA macro excel

At the top of the properties window at the lower left of the above figure,
Change the name on this right (Module1 in the above figure).
The name can be used regardless of half-width,
Numbers cannot be used at the beginning.
Only underscore (_) can be used for the symbol.

Delete "Module1"

When the inserted module is no longer needed and you want to delete it,
There is no deletion, use release.

Right click on “Module1” → “Remove Module1”

VBA macro excel


A message to select "Yes" or "No" will be displayed.

Select “No”.

“Module1” disappeared.

If you select "Yes (Y)", the output destination dialog will be displayed.
The contents of VBA are output as a text-based file.

That's it for creating and deleting places to write macros.

When you write a macro, you always start with this operation.

Articles with the same theme "VBA basics"

1. What is a macro? What is VBA?
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

  • >
  • >
  • 4. Where is the macro written (VBE startup)

  • 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