CBool ​​VBA Function – How to Convert Data to Boolean Type

1. CBool ​​VBA Function – Description

The CBool ​​VBA function returns a value of the Boolean data type, that is, True or False . We can use it to convert both the result of a
logical expression and the number 1 or 0. The CBool ​​function can also be used to convert the text value “True” or “False” to these values ​​in the Boolean data type.

2. VBA CBool ​​Function – Syntax

CBool ​​(expresion)

Expression : A logical expression that evaluates to True or False. It can also be the numbers 1 or 0.

Function Return : Boolean / Values ​​True or False

3. VBA CBool ​​function – Example

How to use the Hour function in VBA Excel? The following are examples of using the Hour function in the VisualBasic Editor.

Example 1:

MsgBox CBool ​​(1 = 2)
MsgBox CBool ​​(1 = 1)

Example 2:

MsgBox CBool ​​("True")
MsgBox CBool ​​("False")

Example 3:

MsgBox CBool ​​(1)
MsgBox CBool ​​(0)
Excel VBA Functions - CBool ​​VBA function
Excel VBA Functions – CBool ​​VBA function

4. VB CBool ​​function – Additional information

  • The function used for the numbers 0 and 1 will return the values ​​False and True.

5. CBool ​​VisualBasic function – Where to use?

The function can be used in: Excel 2003, Excel 2007, Excel 2010, Excel 2013, Excel 2016.

The article is part of the VBA Excel function list. You can find a list of all VBA functions at this address: VBA functions .

Leave a comment

Your email address will not be published. Required fields are marked *

%d bloggers like this: