Return the hex value of *number*

Syntax Hex (number) KeynumberThe number to convert to hex.

If number is not already a whole number, it is rounded to the nearest whole number before being evaluated.

If *number* is Null, Hex() returns Null.

If *number* is Empty, Hex() returns Zero (0).

If *number* is any other number, Hex() returns up to eight hexadecimal characters.

You can represent hexadecimal numbers directly by preceding numbers in the proper range with &H. For example, &H10 represents decimal 16 in hexadecimal notation.

Examples

Dim MyHex

MyHex = Hex(5) ' Returns 5.

MyHex = Hex(10) ' Returns A.

MyHex = Hex(459) ' Returns 1CB.

*“The most important thing in an argument, next to being right, is to leave an escape hatch for your opponent, so that he can gracefully swing over to your side without too much apparent loss of face” ~ Sydney J. Harris*

**Related:**

Int - Return the integer portion of a number