Function DezimalNachBinär(Zahl As Double) As String
Dim Losgehts As Boolean
Dim Ausgabe As String
Dim Exp As Long
If Zahl <= (2 ^ 31) - 1 And Zahl = Int(Zahl) Then
For Exp = 30 To 0 Step -1
If Zahl >= (2 ^ Exp) Then
Ausgabe = Ausgabe & "1"
Zahl = Zahl - (2 ^ Exp)
Losgehts = True
Else
If Losgehts = True Then
Ausgabe = Ausgabe & "0"
End If
End If
Next Exp
Else
Ausgabe = "Sorry, geht nur bis 2.147.483.647"
End If
DezimalNachBinär = Ausgabe
End Function