Learn Excel - Simplify Life with Excel Concepts

Excel CStr Function (VBA)

CStr Function VBA Code

How to use the CStr Function (VBA)

This Excel tutorial explains how to use the Excel CStr function with syntax and examples using VBA.


The Excel VBA CStr function converts an expression into a String data type.

For example,

  • The VBA Code CStr("Hello") would return "Hello"
  • The VBA Code CStr(33.955555) would return "33.955555"


To converts a value to a String.


The CStr function returns a String value.


CStr( expression )


The CStr function syntax has the following arguments:

  • expression: Required. The expression is that you want to convert to a String data value.
    • If "expression" is outside the range of the data type being converted to, an error occurs.
    • If the expression can be interpreted as a date it returns a string representation of that date.


  • The CStr function can only be used in VBA code in Microsoft Excel.
  • The CStr Function can convert different types of expression (Integer, Boolean and Date) into String data types
  • You can use the CStr function if you want to return a numerical values as a string.
  • The Single data type is a Value data type.
  • VBAs hexadecimal notation symbol is "&H"

Useful Links: Link 1Link 2Link 3Link 4