Skip to main content

Range.Text property

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.

If the contents of the cell is wider than the width available for display, the Text property will modify the displayed value.

Property Differences Example

This example illustrates the difference between the Text and Value properties of cells that contain formatted numbers.

Option Explicit

Public Sub DifferencesBetweenValueAndTextProperties()
    Dim cell As Range
    Set cell = Worksheets("Sheet1").Range("A1")
    cell.Value = 1198.3
    cell.NumberFormat = "$#,##0_);($#,##0)"
    MsgBox "'" & cell.Value & "' is the value." 'Returns: "'1198.3' is the value."
    MsgBox "'" & cell.Text & "' is the text."    'Returns: "'$1,198' is the text."
End Sub

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>