Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Private Function HexToDec(ByVal strNum As String) As String
'converts hexadecimal to decimal
Dim intLength As Integer 'length of text box
Dim i As Integer 'counter
Dim lngNumber As Long 'value of each character
Dim dblSum As Double 'answer
Dim strTemp As String 'variable that holds each character
intLength = Len(Trim(txtInput.Text))
'looping length of text box to convert characters 1 by 1
For i = intLength To 1 Step -1
strTemp = Mid(strNum, i, 1)
'case statement to convert alpha charachters to numeric
Select Case strTemp
Case "a"
lngNumber = 10
Case "b"
lngNumber = 11
Case "c"
lngNumber = 12
Case "d"
lngNumber = 13
Case "e"
lngNumber = 14
Case "f"
lngNumber = 15
Case Else
lngNumber = Val(strTemp)
End Select
dblSum = dblSum + (lngNumber * (16 ^ (intLength - i)))
Next i
HexToDec = CStr(dblSum)
End Function