# VBA CBOOL Function

Home ➜ VBA Functions LIST (Category Wise) ➜ **How to use the VBA CBOOL Function (Syntax + Example)**

## What is VBA CBOOL Function

The VBA CBOOL 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 a boolean value**. In simple words, it converts all the non-zero values to TRUE and zeroes to FALSE and returns that in the result. You can also use it in a logical test.

## how to use it

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

### Syntax

**CBool(Expression)**

### Arguments

**Expression:**The expression is the number that you want to convert into a boolean value

## Example to use CBOOL Function in VBA

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

Sub example_CBOOL() Range("B1").Value = CBool(Range("A1")) End Sub

In the above example, we have used the value from the cell A1 where we have a number (3) and then we have used the CBOOL function to convert that value into a boolean and it has returned TRUE in the result.

## Notes

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

- If the value specified is a value other than a number or a number which can’t be recognized as a number, VBA will return the run-time 13 error.

About the Author

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 ﬁnd him online, tweeting about Excel, on a running track, or sometimes hiking up a mountain.