How to convert Decimal Number to Binary Number
Posted on January 5, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 'Math - How to convert Decimal Number to Binary Number Public Function Dec2Bin(myNum As Variant) As String Dim loopcounter As Integer If myNum >= 2 ^ 31 Then Dec2Bin = "Number too big" Exit Function End If Do If (myNum And 2 ^ loopcounter) = 2 ^ loopcounter Then Dec2Bin = "1" & Dec2Bin Else Dec2Bin = "0" & Dec2Bin End If loopcounter = loopcounter + 1 Loop Until 2 ^ loopcounter > myNum End Function Private Sub Main() MsgBox Dec2Bin(63923) End Sub |
Related posts:
- How to convert Binary Number to Decimal Number
- How to Convert from decimal to binary
- How to Conversion (Binary, Hexa Decimal, Octal, Decimal)
- How to Convert Binary to Decimal
- How to Convert a decimal number into a Roman number?
- How to convert Hexadecimal number to Decimal number
- How to convert Decimal Number to Hexadecimal Number
- How to convert Octal to Decimal number
- How to Convert Decimal to Hexadecimal
- How to Convert Binary to Octal