Get Hexadecimal Method
The Get Hexadecimal Method returns the hexadecimal representation of the value in the number argument. It returns this value in a string. If the value in the number argument:
Is an integer. The return string contains up to four hexadecimal digits.
Is not an integer. This method converts the value to a long integer, and the string can contain up to eight hexadecimal digits.
You precede the hexadecimal value with the following characters to express a hexadecimal number:
&H
For example, &H10 equals decimal 16 in hexadecimal notation.
Format
Hex[$](number)
For information about the dollar sign, see Usage of the Dollar Sign.
This method uses the same arguments as the Get Absolute Value method. For more information, see Get Absolute Value Method.
Example
The following example returns the hex value for a number that the user enters:
Sub Button_Click
Dim usernum as Integer
Dim hexvalue as String
usernum = 23
hexvalue = Hex(usernum)
End Sub