Literal

&h


Description

Used to represent a hexadecimal literal.

Usage

&hHexNumber

Part

Type

Description

HexNumber

Hexadecimal number

A hexadecimal literal value.

Notes

To write a hexadecimal literal, precede the value with &h.

Sample code

Assign a number using a hex literal:

Var hex As Integer
hex = &hff ' hex = 255 as a decimal integer

To get the numerical value (myValue) of a hexadecimal string (s):

Var myValue As Integer
myValue = Val("&h" + s)
' If s is "A4", myValue will contain the value 164 which corresponds to &hA4

Compatibility

All project types on all supported operating systems.

See also

Hex function.