how do i convert an octal (base 8) value to a decimal value (base 10)
how do i convert an octal (base 8) value to a decimal value (base 10)
May or may not help...
Val(string)
The required stringargument is any validstring expression.
Remarks
The Val function stops reading the string at the first character it can't recognize as part of a number. Symbols and characters that are often considered parts of numeric values, such as dollar signs and commas, are not recognized. However, the function recognizes the radix prefixes &O (for octal) and &H (for hexadecimal). Blanks, tabs, and linefeed characters are stripped from the argument.
huh?
How do you do binary
Base 10 to Binary:Quote:
Originally posted by Bjwbell
How do you do binary
Code:Const a = 1
Const b = 2
Const c = 4
Const d = 8
Const e = 16
Const f = 32
Const g = 64
Const h = 128
Const i = 256
Public Function BinConv(intval As Long) As String
If Int(intval) >= Int(i) Then
BinConv = BinConv & 1
intval = intval - i
Else
BinConv = BinConv & 0
End If
Debug.Print Int(intval) & " " & BinConv
If Int(intval) >= Int(h) Then
BinConv = BinConv & 1
intval = intval - h
Else
BinConv = BinConv & 0
End If
Debug.Print Int(intval) & " " & BinConv
If Int(intval) >= Int(g) Then
BinConv = BinConv & 1
intval = intval - g
Else
BinConv = BinConv & 0
End If
Debug.Print Int(intval) & " " & BinConv
If Int(intval) >= Int(f) Then
BinConv = BinConv & 1
intval = intval - f
Else
BinConv = BinConv & 0
End If
Debug.Print Int(intval) & " " & BinConv
If Int(intval) >= Int(e) Then
BinConv = BinConv & 1
intval = intval - e
Else
BinConv = BinConv & 0
End If
Debug.Print Int(intval) & " " & BinConv
If Int(intval) >= Int(d) Then
BinConv = BinConv & 1
intval = intval - d
Else
BinConv = BinConv & 0
End If
Debug.Print Int(intval) & " " & BinConv
If Int(intval) >= Int(c) Then
BinConv = BinConv & 1
intval = intval - c
Else
BinConv = BinConv & 0
End If
Debug.Print Int(intval) & " " & BinConv
If Int(intval) >= Int(b) Then
BinConv = BinConv & 1
intval = intval - b
Else
BinConv = BinConv & 0
End If
Debug.Print Int(intval) & " " & BinConv
If Int(intval) >= Int(a) Then
BinConv = BinConv & 1
intval = intval - a
Else
BinConv = BinConv & 0
End If
End Function
thanks
Pikachu_902, I searched http://www.planet-source-code.com and a few results came up on Base Conversion.
Here's some base convertion methods:
http://forums.vb-world.net/showthrea...threadid=18927
I figured it out awhile ago from my first reply
val("&O400") = 256!!!
So be not so quick to judge HeSaidJoe, because he was right
and Oct(256) = 400
Gees, You all know &H but not &O ??
:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D:D
Yep, i think Hesaidjoe should be Guru, i didn't know the "&O" thing for instance, but i don't think you can convert to base 23 with a "&Q" hehe :D
In Australia they'd award him the order of the Dead-Set-Legend !!
Hehe, what's that? DLS?
You've heard of it then?
eh, no, that was a joke, like DSL connection