Range.Text property (Excel)
Returns the formatted text for the specified object. Read-only String.
expression A variable that represents a Range object.
The Text property is most often used for a range of one cell. If the range includes more than one cell, the Text property returns Null, except when all the cells in the range have identical contents and formats.
This example illustrates the difference between the Text and Value properties of cells that contain formatted numbers.
Dim c As Range c.Value = 1198.3 Set c = Worksheets("Sheet1").Range("A1") c.NumberFormat = "$#,##0_);($#,##0)" c.Value = 1198.3 MsgBox c.Value c.NumberFormat = "$#,##0_);($#,##0)" MsgBox c.Text MsgBox c.Value & " is the value." 'Returns "1198.3 is the value." MsgBox c.Text & " is the text." 'Returns "$1,198 is the text."
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.