The following code will convert a decimal number into a 8 bit binary. If you want to convert bigger numbers simply change the loop counter to the number of bits you want - 1.
Code:Dim iNum As Integer Dim iPos As Integer Dim s As String iNum = 28 For iPos = 0 To 7 If (iNum And (2 ^ iPos)) Then s = "1" & s Else s = "0" & s End If Next iPos MsgBox s




Reply With Quote