VB Code:
Private Function DecToBin(ByVal Dec As Double) As Double Dim strTValue As String, strValue As String Do strTValue = Str(Dec Mod 2) strValue= strTValue & strValue Dec = IIf(Right(Str(Dec), 2) = ".5", Dec - 0.5, IIf(Dec Mod 2 > 0, Dec - 1, Dec)) / 2 Loop Until Dec = 0 DecToBin = Val(strValue) End Function
