HEX(number)

Returns the number converted to hexadecimal (String).


numberThe number you want to convert to hexadecimal (String or Double).

REMARKS
* If "number" is Null, then Null is returned
* If "number" is empty, then 0 is returned.
* Each value may contain the numbers 0-9 and the letter A-F.
* The hexadecimal number returned can be up to 8 characters long.
* If "number" is not a whole number, then it is rounded to the nearest whole number.
* You can use the OCT function to return the number converted to octal.
* You can use the HEX$ function to return a String data type instead of a Variant/String data type.
* The equivalent Excel function is BIN2HEX
* The equivalent .NET function is Microsoft.VisualBasic.Conversion.Hex
* For the Microsoft documentation refer to docs.microsoft.com

Debug.Print Hex(9)      '= 9  
Debug.Print Hex(10) '= A
Debug.Print Hex(16) '= 10
Debug.Print Hex(255) '= FF
Debug.Print Hex(256) '= 100
Debug.Print Hex(&H100) '= 100
Debug.Print Hex(&O12) '= A
Debug.Print Hex(&O77) '= 3F

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