Return the hex value of a number.

      Hex (number)

   number   The 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.

The Hex() function can be used in VBA or in an SQL query.



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


Int - Return the integer portion of a number

Copyright © SS64.com 1999-2017
Some rights reserved