Hex2Dec

Converts hexadecimal strings into decimals

CodeFunctionName
What is this?

Public

Tested

Imported
Function Hex2Dec(strHex)
dim lngResult, intIndex, strDigit, intDigit, intValue
lngResult = 0
For intIndex = len(strHex) to 1 step -1
strDigit = mid(strHex, intIndex, 1)
intDigit = instr("0123456789ABCDEF", ucase(strDigit))-1
If intDigit >= 0 then
intValue = intDigit * (16 ^ (len(strHex)-intIndex))
lngResult = lngResult + intValue
Else
lngResult = 0
intIndex = 0 ' stop the loop
End if
Next
Hex2Dec = lngResult
End Function

strHex

Views 3,899

Downloads 1,298

CodeID
DB ID

ANmarAmdeen
610
Revisions

v2.0

Sunday
July
29
2018