Characters Method

Applies To

AxisTitle Object, Button Object, Buttons Collection, ChartTitle Object, CheckBox Object, DataLabel Object, DialogFrame Object, DrawingObjects Collection, DropDown Object, DropDowns Collection, EditBox Object, EditBoxes Collection, GroupBox Object, GroupBoxes Collection, Label Object, Labels Collection, OptionButton Object, OptionButtons Collection, Range Object, TextBox Object, TextBoxes Collection.

Description

Accessor. Returns a Characters object that represents a range of characters within the object text. This allows you to format characters within a text string.

Syntax

object.Characters(start, length)

object

Required. The object to which this method applies.

start

Optional. The first character to return. If this argument is one or omitted, this method returns a range of characters starting with the first character.

length

Optional. The number of characters to return. If this argument is omitted, this method returns the remainder of the string after the start character.

Remarks

For a Range object, this method will fail if it is used with arguments and the cell does not contain a text value.

Example

This example formats the third character in cell A1 on Sheet1 as bold.


With Worksheets("Sheet1").Range("A1")
    .Value = "abcdefg"
    .Characters(3, 1).Font.Bold = True
End With