Private Sub cmdConvert_Click() decimalValue = 0 base16 = txtNumber.Text ' base16 is the hexadecimal number ' for example: FF is base 16 for 255 ' 10 is 16 100 = 256 16 10 16 10 A0F would be 10 times 256 = 2560 plus 0 times 16 = 0 plus 15 times 1 = 15 placeValue = 1 ----- 2575 For i = Len(base16) To 1 Step -1 c = Mid(base16, i, 1) ' Using the Mid() string function If c >= "0" And c <= "9" Then v = Val(c) ElseIf c >= "A" And c <= "F" Then ' A = 10, B = 11, ..., F = 15 v = Asc(c) - 55 'ascii value Else Form1.Caption = "base16 Digits Only 0,1,...,E,F" End If decVal = decVal + v * placeValue placeValue = placeValue * 16 Next i Print "Decimal Value of " & txtNumber & " is " & decVal End Sub