The Text property

The Text property returns a string that represents the text as displayed in a cell — the formatted value. The Text property is read-only. For example, suppose that cell A1 contains the value 12.3 and is formatted to display two decimals and a dollar sign ($12.30). The following statement displays a message box containing $12.30:

MsgBox Worksheets("Sheet1").Range("A1").Text

But the next statement displays a message box containing 12.3:

MsgBox Worksheets("Sheet1").Range("A1").Value

0 0

Post a comment