# Opposite of Hex function?

Hello all!
I am wondering if there is any opposite of the Hex function?
Ex. Hex(255) returns FF.
Then should ThatFunction(FF) return 255!
LVL 4
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Function HexStringToDecimal(Hex As String) As Long

Dim strIn\$, i&, j&, k&, c\$
strIn = Trim\$(Hex)
If Len(strIn) > 8 Then
'Overflow
Exit Function
End If
For i = Len(strIn) To 1 Step -1
c = UCase(Mid\$(Hex, i, 1))
Select Case c
Case "0" To "9"
k = k + CLng(c) * 16 ^ j
Case "A" To "F"
k = k + (Asc(c) - 55) * 16 ^ j
Case Else
'Invalid character Error
Exit Function
End Select
j = j + 1
Next
HexStringToDecimal = k

End Function

0

Experts Exchange Solution brought to you by