VBA Convert Integer (Number) To String - Automate Excel
Return to VBA Code Examples
Written by
Editorial Team
Reviewed by
Steve Rynearson
Last updated on July 23, 2021We have already covered an introduction to string functions in our VBA Strings and Substrings Functions tutorial. In this tutorial, we are going to look at how to convert an integer to a string (click here to learn about converting Strings to Numbers). The reason you would want to convert a number or date to a string is in order to use string manipulation functions on these values.
The VBA CStr Function
The VBA CStr Function allows you to convert a number, date or boolean data type to a string.
MsgBox CStr (88)The syntax of the CStr Function is:
CStr(expression) where expression is the number or date that you want to convert.
The following code shows you how numbers are outputted compared to text, including by using the CStr Function.
Sub UsingTheConvertToStringFunction() Debug.Print CStr(8) Debug.Print "Text" Debug.Print 8 Debug.Print 2 End SubThis uses Debug.Print to output the results to the Immediate Window.

Both CStr(8) and the word Text are displayed as text and are left aligned whereas the two numbers are right aligned within the immediate window.
VBA Coding Made Easy
Stop searching for VBA code online. Learn more about AutoMacro - A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!
Learn More!
VBA Code Examples Add-in
Easily access all of the code examples found on our site.
Simply navigate to the menu, click, and the code will be inserted directly into your module. .xlam add-in.
(No installation required!)
Free Download
Return to VBA Code Examples
AutoMacro: VBA Add-in with Hundreds of Ready-To-Use VBA Code Examples & much more!
Learn MoreTừ khóa » ép Kiểu Vba
-
Bài 7.6. Hàm Chuyển đổi Kiểu Dữ Liệu | Giải Pháp Excel
-
Các Hàm Chuyển đổi Kiểu - Microsoft Support
-
Biến Và Kiểu Dữ Liệu Trong VBA - VietTuts
-
Làm Cách Nào để Tôi Chuyển đổi Một Số Nguyên Thành Một Chuỗi ...
-
Hướng Dẫn Cơ Bản Về Hàm String (chuỗi) Trong Vba
-
VBA Macro - Bài 05 - Cách Sử Dụng Biến Trong cx
-
Convert String To Number | Tự Học VBA
-
Thầy Giáo Giải Thích Cho Mình Câu Này Trong Sách Vba được...
-
VBA Là Gì? Những điều Cơ Bản Về VBA Trong Excel
-
Những Chủ đề Tiến Bộ Trong C# - Các ép Kiểu Do Người Dùng định ...
-
Máy ép, Duỗi Tóc Bán Bởi Cửa Hàng Vba
-
Bắt đầu Với VBA Cơ Bản Hello VBA
-
Đủ Kiểu ăn Mừng 'cà Khịa' đối Thủ ở Giải Bóng Rổ VBA 2022
-
Lỗi VBA Trong Việc Tính Toán Số Quá Lớn! - Forums