Str function

Category: Conversion

Summary

String of a number (leading space for positive).

Syntax

Returns a Variant (String) representation of a number.

Example

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".

Microsoft Support Page

https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/str-function

Back to Functions