by Luc Belliveau (1 Submission)
Category: Math/Dates
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Tue 4th June 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Hex to Decimal converter
Select Case UCase(Num)
Case "A"
HexNumValue = 10
Case "B"
HexNumValue = 11
Case "C"
HexNumValue = 12
Case "D"
HexNumValue = 13
Case "E"
HexNumValue = 14
Case "F"
HexNumValue = 15
Case Else
HexNumValue = Val(Num)
End Select
End Function
Private Function Dec(ByVal HexNumber As String) As Long
Dim ch As Integer
Dim adder As Long
For x = 1 To Len(HexNumber)
ch = HexNumValue(Mid(HexNumber, x, 1))
t = 16 ^ (Len(HexNumber) - x)
adder = adder + (ch * t)
Next x
Dec = adder
End Function