OzGrid

Convert to a String Data Type

< Back to Search results

 Category: [Excel]  Demo Available 

Convert to a String Data Type

 

Excel VBA: Convert to a String Data Type

Got any Excel/VBA Questions? Free Excel Help 

The example below shows how CStr can be used in Excel VBA to convert to a String data type. Returns for CStr depend on the expression argument... Boolean = A string containing True or False. Date = A string containing a date in the short date format of your system. Null = A run-time error. Empty = A zero-length string (""). Error = A string containing the word Error followed by the error number. Other numeric = A string containing the number.

Sub ConvertToString()

Dim vStr



vStr = 10000

MsgBox IsNumeric(strNum)

MsgBox IsNumeric(CStr(strNum))



End Sub

 

See also:

Convert a String or Number to Boolean
Convert a String to a Byte Data Type
Convert to a Currency Data Type
Convert to a Date Data Type
Convert to a Decimal Data Type
Convert to a Double Data Type
Convert to a Integer Data Type
Excel VBA: Convert to a Long Data Type
Convert to a Single Data Type
Convert Excel Text To Upper Case
Excel VBA: Convert to a Variant Data Type

 

Free Training Course: Lesson 1 - Excel Fundamentals

 

See also: Index to Excel VBA Code; Index to Excel Freebies; Lesson 1 - Excel Fundamentals; Index to how to… providing a range of solutions

 

Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.


Gallery



stars (0 Reviews)