Home > How-To Library > Coding Basics
How to Convert Hexadecimal to Decimal
**************************************************************** * © 2007 CodeItBetter http://www.codeitbetter.com * * This notice MUST stay intact for legal use * **************************************************************** Public Function ConvertHexadecimalToDecimal(BinVal As String) As String Dim iVal#, temp#, i%, Length% Length = Len(BinVal) For i = 0 To Length - 1 temp = HexToNo(Mid(BinVal, Length - i, 1)) iVal = iVal + (temp * (16 ^ i)) Next i ConvertHexadecimalToDecimal = iVal End Function Private Function HexToNo(i As String) As Integer Select Case i Case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9": HexToNo = CInt(i) Case "A", "a": HexToNo = 10 Case "B", "b": HexToNo = 11 Case "C", "c": HexToNo = 12 Case "D", "d": HexToNo = 13 Case "E", "e": HexToNo = 14 Case "F", "f": HexToNo = 15 End Select End Function
If you would like to submit your code here please us. Do not forget to mention your name. We are always thankful to each and everyone of you who submitted their code here.