Defining Ranges

You can use the Font object to specify the font attributes for specify objects within Excel. Typically you use it to modify the attributes of a cell or a range of cells. The Font object has several properties that allow you to view or modify the attributes of the specified object. The following table lists the common properties you can use with the Font object.

FONT PROPERTY

DESCRIPTION

Bold

A Boolean value indicating whether the font for the object is bold.

Color

Indicates the color of the font. Use the RGB function to set the font color.

FontStyle

Indicates the font style. For example, to set both a bold and underline font style you specify Font.FontStyle = "Bold Underline"

Italic

A Boolean value indicating whether the font for the object is italics.

Shadow

A Boolean value indicating whether the font is a shadow font.

Size

Indicates the size of the font.

Strikethrough

A Boolean value indicating whether a strikethrough font is used. A strikethough font draws a horrizontal line through each character in the font.

Subscript

A Boolean value indicating whether the font is subscript.

Superscript

A Boolean value indicating whether the font is superscript.

Underline

A Boolean value indicating whether the font is underlined.

Q Type Next. □ Switch to Excel and run

■ The value and font attributes of the specified cells are changed.

L0 Type Cells(N, 1).Font.Bold = True, replacing Bold with the font attribute to assign to the cells.

■ You can use any properties, methods, or child objects of the Range object to customize the selected range of cells.

Q Type Next. □ Switch to Excel and run the macro.

■ The value and font attributes of the specified cells are changed.

0 0

Post a comment