Share via


Visual Basic for Applications Reference

Str Function Example

This example uses the Str function to return a string representation of a number. When a number is converted to a string, a leading space is always reserved for its sign.

  Dim MyString
MyString = Str(459)   ' Returns " 459".
MyString = Str(-459.65)   ' Returns "-459.65".
MyString = Str(459.001)   ' Returns " 459.001".