官术网_书友最值得收藏!

Using the VBA Editor

We've worked with the VBA Editor before, but that was on another file, with a different Sub procedure. The recipe we're going to work with here will show you how to activate the VBA Editor in your own file. Furthermore, we're going to identify various components within the editor.

Getting ready

With 02_RecordMacro.xlsx still open, we're going to activate the VBA Editor. Whether you are on Sheet1, Sheet2, or Sheet3 is of no consequence, because the macro is part of the workbook.

How to do it…

Let's go through the steps for this recipe:

  1. The standard way to activate the VBA Editor is to navigate to Developer | Code | Macros, and then select Edit on the Macro dialog box.
  2. The shortcut key makes life much easier. Simply hold down the Alt key while pressing F11. This time, you bypass the dialog box by going straight to the VBA Editor:

Figure 1.15 – A Sub procedure in the VBA Editor

The evidence of what we recorded is displayed in the code window.

How it works…

Opening the VBA Editor can be done in one of two ways: with the Alt + F11 keyboard shortcut, or by clicking on Edit in the Macro dialog box.

In the VBA Editor, you will find the following basic components:

Figure 1.16 – Components of the VBA Editor

There's more…

Each element, or component, of the VBA Editor has a specific function. Up until now, we've only used the code window. In future recipes, we will be referring to and using the other elements.

主站蜘蛛池模板: 巴彦县| 平阴县| 孝昌县| 庆云县| 庄浪县| 昌平区| 耿马| 临海市| 井冈山市| 资溪县| 阳谷县| 石楼县| 建平县| 武平县| 海兴县| 云龙县| 民勤县| 巴中市| 云浮市| 会昌县| 云林县| 娱乐| 体育| 沁源县| 疏勒县| 辰溪县| 连山| 慈利县| 沙湾县| 巢湖市| 亚东县| 鄂伦春自治旗| 吉木萨尔县| 锦屏县| 克什克腾旗| 石棉县| 盱眙县| 汶川县| 麟游县| 肇州县| 山东省|