18.11.2014 Views

Microsoft Office

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Part VI<br />

Programming Excel with VBA<br />

FIGURE 39.6<br />

This VBA function returns the cube root of its argument.<br />

Creating VBA functions that you use in worksheet formulas can simplify your formulas and<br />

CROSS-REF<br />

enable you to perform calculations that otherwise may be impossible. Chapter 40 discusses<br />

VBA functions in greater detail.<br />

Some Definitions<br />

VBA newcomers are often overwhelmed by the terminology that is used in VBA. I’ve put together some key<br />

definitions to help you keep the terms straight. These terms cover VBA and UserForms (custom dialog<br />

boxes) — two important elements that are used to customize Excel:<br />

n Code: VBA instructions that are produced in a module sheet when you record a macro. You also<br />

can enter VBA code manually.<br />

n Controls: Objects on a UserForm (or in a worksheet) that you manipulate. Examples include buttons,<br />

check boxes, and list boxes.<br />

n Function: One of two types of VBA macros that you can create. (The other is a Sub procedure.) A function<br />

returns a single value. You can use VBA functions in other VBA macros or in your worksheets.<br />

n Macro: A set of VBA instructions performed automatically.<br />

n Method: An action taken on an object. For example, applying the Clear method to a Range<br />

object erases the contents and formatting of the cells.<br />

n Module: A container for VBA code.<br />

n Object: An element that you manipulate with VBA. Examples include ranges, charts, drawing<br />

objects, and so on.<br />

n Procedure: Another name for a macro. A VBA procedure can be a Sub procedure or a Function<br />

procedure.<br />

n Property: A particular aspect of an object. For example, a Range object has properties, such as<br />

Height, Style, and Name.<br />

n Sub procedure: One of two types of Visual Basic macros that you can create. The other is a function.<br />

n UserForm: A container that holds controls for a custom dialog box and holds VBA code to manipulate<br />

the controls. (Chapters 41 and 42 explain UserForms in depth.)<br />

n VBA: Visual Basic for Applications. The macro language that is available in Excel, as well as in the<br />

other applications in <strong>Microsoft</strong> <strong>Office</strong>.<br />

n VB Editor: The window (separate from Excel) that you use to create VBA macros and UserForms.<br />

686

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!