VBA CINT Function

HomeVBA Functions LIST (Category Wise)How to use the VBA CINT Function (Syntax + Example)

What is VBA CINT Function

The VBA CINT function is listed under the data type conversion category of VBA functions. When you use it in a VBA code, it converts an expression into an integer. In simple words, an integer as per VBA’s integer data type can be any value between -32,768 and 32,767 (without any decimals).

how to use it

To use VBA's CINT function you need to understand its syntax and arguments:




  • Expression: The value which you want to convert to an integer.

Example to use CINT Function in VBA

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

Sub example_CINT()
Range("B1").Value = CInt(Range("A1"))
End Sub

In the above example, we have used the value from cell A1 (9.76) and then we have used the CINT function to convert that value into an integer data type and it has returned 10 in the result.


Below are some important points which you need to take care while using CINT function in VBA.

  • CINT will round that number which is greater than 0.5 and round down if lower than or equals 0.5.
  • If you supply a number which is out of the range of integer data type (-32,768 and 32,767), VBA will return the run-time 13 error.

About the Author

puneet one point one

Puneet is using Excel since his college days. He helped thousands of people to understand the power of the spreadsheets and learn Microsoft Excel. You can find him online, tweeting about Excel, on a running track, or sometimes hiking up a mountain.