Excel 2019 Bible

(singke) #1

Part VI: Automating Excel


Macro A set of VBA instructions.
Method An action taken on an object. For example, applying the Clear method to a Range object
erases the contents and formatting of the cells.
Module A container for VBA code.
Object An element that you manipulate with VBA. Examples include ranges, charts, and drawing objects.
Procedure Another name for a macro. A VBA procedure can be a Sub procedure or a Function procedure.
Property A particular aspect of an object. For example, a Range object has properties, such as Height,
Style, and Name.
Sub procedure One of two types of VBA macros that you can create. The other is a Function.
UserForm A container that holds controls for a custom dialog box and holds VBA code to manipulate
the controls.
VBA Visual Basic for Applications. The macro language that is available in Excel as well as in the other
Microsoft Office applications.
VBE Visual Basic Editor. The window (separate from Excel) that you use to create VBA macros and
UserForms. Press Alt+F11 to toggle between Excel and the VBE.

Chapter 44, “Creating UserForms,” and Chapter 45, “Using UserForm Controls in a Worksheet,” explain
UserForms in depth.

Creating VBA Macros
Excel provides two ways to create macros:

■ (^) Turn on the macro recorder and record your actions.
■ Enter the code directly into a VBA module.
The following sections describe these methods.
Recording VBA macros
In this section, we describe the basic steps that you take to record a VBA macro. In most
cases, you can record your actions as a macro and then simply replay the macro; you don’t
need to look at the code that’s automatically generated. If simply recording and playing
back macros is as far as you go with VBA, you don’t need to be concerned with the language
itself (although a basic understanding of how things work can be helpful).
continued

Free download pdf