- Home
·
- Math/Dates
·
- As well as Hex(), VB will convert decimal to octagonal, but not back again. Here's how... Also, for
As well as Hex(), VB will convert decimal to octagonal, but not back again. Here's how... Also, for
As well as Hex(), VB will convert decimal to octagonal, but not back again. Here's how... Also, forgot to mention last time, my Dec2Bin &
Rate As well as Hex(), VB will convert decimal to octagonal, but not back again. Here's how... Also, for
(2(2 Vote))
multiplier = 1
decout = 0
octstr = "01234567"
For i = Len(myoct) To 1 Step -1
z = Mid(myoct, i, 1)
v = Val(InStr(1, octstr, z)) - 1
If v + 1 = 0 Then
MsgBox "Invalid input", , "Error"
decout = -1
Exit Function
End If
decout = decout + v * multiplier
multiplier = multiplier * 8
Next i
End Function
Sub convertOct2Dec()
Dim decout As Long
Dim myoct As String
myoct = InputBox("Octagonal")
Octagonal2Decimal myoct, decout
If decout <> -1 Then MsgBox decout
End Sub
As well as Hex(), VB will convert decimal to octagonal, but not back again. Here's how... Also, for Comments
No comments yet — be the first to post one!
Post a Comment