30 Advanced Excel Tips for 2026

Excel Champs / VBA / Top VBA Functions / VBA CSTR Function (Syntax + Example)
By Puneet Gogia (Microsoft MVP)

VBA CSTR Function (Syntax + Example)

30+ Advanced Excel Tips for 2026

No spam. Only Excel Stuff. God Promise. 😊

The VBA CSTR function is listed under the data type conversion category of VBA functions. When you use a VBA code, it converts an expression into the string data type. In simple words, with CSTR you can convert different types of values like boolean, Integer, or date into a string type value.

Syntax

CStr(Expression)

Arguments

  • Expression: The value which you want to convert to a string data type.

Example

To practically understand how to use the VBA CSTR function, you need to go through the below example where we have written a vba code by using it:

example-vba-cstr-function
Sub example_CSTR()
Range("B1").Value = CStr(Range("A1"))
End Sub

In the above example, we have used the value from cell A1 (1-Jan-19) and then we have used the COS to convert that value into a string data type and it has returned 1/1/2019 in the result.

Notes

  • If a date is specified as an expression it will return the text representation of the that as mm/dd/yyyy.
Puneet Gogia

Written by

Puneet Gogia

Microsoft MVP — Excel · Founder, Excel Champs

Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.

3M+ readers helped
1,000+ tutorials written
Since 2015 teaching Excel