DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

hexadecimal to decimal conversion

Looking for a quick way to convert hexidecimal valuse stored as text in to decimal number to be stored as a numeric
0 Kudos
Message 1 of 3
(4,144 Views)
Hello Lman!
 
The fastest way I know is to use the VBS eval function. Just add the '&H' to the beginning of the text.
 
Example:
Option Explicit

Dim sgHexText

sgHexText = "12AB"

MsgBox Eval("&H" & sgHexText)
Matthias
Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 2 of 3
(4,127 Views)

Hi Lman,

Twigeater's syntax is perfect as usual.  I would just like to add that I always call CLng(&h....) to evaluate the hex string and convert it to a number.  There may not be much difference under the hood, but it looks aesthetically to me like less of a hack that way.

Greetings,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 3 of 3
(4,104 Views)