Hex

Return the hex value of a number.

Syntax
      Hex (number)

Key
   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.

hex

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


 
Copyright © 1999-2024 SS64.com
Some rights reserved