Text Method

Microsoft Excel Visual Basic

Show All

Text Method

       

Text method as it applies to the WorksheetFunction object.

Converts a value to text in a specific number format.

expression.Text(Arg1, Arg2)

expression   Required. An expression that returns one of the above objects.

Arg1  Required Variant. A numeric value, a formula that evaluates to a numeric value, or a reference to a cell containing a numeric value.

Arg2  Required String. A number format in text form in the Category box on the Number tab in the Format Cells dialog box.

 

Text method as it applies to the Comment object.

Sets comment text.

expression.Text(Text, Start, Overwrite)

expression   Required. An expression that returns one of the above objects.

Text  Optional Variant. The text to be added.

Start  Optional Variant. The character number where the added text will be placed. If this argument is omitted, any existing text in the comment is deleted.

Overwrite  Optional Variant. True to overwrite the existing text. The default value is False (text is inserted).

 

Example

This example adds a comment to cell E5 on sheet one.

With Worksheets(1).Range("e5").AddComment
    .Visible = False
    .Text "reviewed on " & Date
End With