CBYTE(expression)

Returns the expression converted to a byte data type (Byte).


expressionThe expression to evaluate and convert to a byte.

REMARKS
* The Byte data type is a Value data type.
* The "expression" can be any numerical value between 0 to 255 (Integer).
* A byte takes up a single byte of computer memory and can have a value from 0 to 255.
* This data type is commonly used for file formats and data conversions.
* If the expression is not a floating point number then it is rounded to the nearest integer.
* An overflow error will occur if the value is out of range.
* For a full list of conversion functions refer to the Explicit Conversion page.
* For the Microsoft documentation refer to docs.microsoft.com

Debug.Print CByte(10)           '= 10  
Debug.Print CByte("some text") '= "Type mismatch error"
Debug.Print CByte(256) '= "Overflow error"
Debug.Print CByte(-1) '= "Overflow error"

© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited Top