ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   convert hex-values to decimal values (https://www.excelbanter.com/excel-programming/275511-convert-hex-values-decimal-values.html)

Markus Früh

convert hex-values to decimal values
 
hello everybody

i need a function to convert hex-values to deciaml-values (excel 2000)

example:
hex2dec("5A") - result: "90"


who can help me?
thanks
markus



Wild Bill[_2_]

convert hex-values to decimal values
 
http://www.experts-exchange.com/Appl..._20658588.html

On Thu, 28 Aug 2003 "Markus Früh" wrote:
i need a function to convert hex-values to deciaml-values (excel 2000)

example:
hex2dec("5A") - result: "90"


Markus Früh

convert hex-values to decimal values
 
hello

thanks for the link. but there is no help. they write about a function
called HEX2DEC() , but i do not have such a function? i have installed all
"add-ins" but my excel2000 (german) do not find this function?

has anybody an other solution?

thanks
markus


"Wild Bill" schrieb im Newsbeitrag
...
http://www.experts-exchange.com/Appl..._20658588.html




On Thu, 28 Aug 2003 "Markus Früh" wrote:
i need a function to convert hex-values to deciaml-values (excel 2000)

example:
hex2dec("5A") - result: "90"



Wild Bill[_2_]

convert hex-values to decimal values
 
Now that I look at it more closely I see a lot of noise there. Try the
code in routine Button1_Click there and see if you can adapt that logic.

Keith Willshaw

convert hex-values to decimal values
 

"Markus Früh" wrote in message
...
hello

thanks for the link. but there is no help. they write about a function
called HEX2DEC() , but i do not have such a function? i have installed all
"add-ins" but my excel2000 (german) do not find this function?


The inbuilt function is Hex(no)

Keith




Wild Bill[_2_]

convert hex-values to decimal values
 
http://www.aboutvb.de/khw/artikel/khwhextodec.htm no doubt :) Good.
I didn't realize that Val had that capability - but it's right there in
its help.

On Thu, 28 Aug 2003, "Markus Früh" wrote:
thanks bill

i have found the following code:

Public Function HexToDec(HexValue As String) As Long
On Error Resume Next
If UCase$(Left$(HexValue, 2)) = "0X" Then
HexToDec = Val("&H" & Mid$(HexValue, 3))
ElseIf UCase$(Left$(HexValue, 2)) < "&H" Then
HexToDec = Val("&H" & HexValue)
Else
HexToDec = Val(HexValue)
End If
End Function

with this, it runs!


Wild Bill[_2_]

convert hex-values to decimal values
 
or clng, etc.

On Thu, 28 Aug 2003 10:22:34 +0100, "Keith Willshaw"
wrote:


"Markus Früh" wrote in message
...
hello

thanks for the link. but there is no help. they write about a function
called HEX2DEC() , but i do not have such a function? i have installed all
"add-ins" but my excel2000 (german) do not find this function?

has anybody an other solution?

thanks
markus



Sorry I misread your post

The function you need is

Variant=CDEC("String")

Where String is the hex number prefixed with &H

Thus

MsgBox CDec("&HC1A")

would output 3098

Keith




All times are GMT +1. The time now is 12:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com