'Taschenrechnersektion
'unter UserForm in VBA
Public Addition As Double
Public Subtraktion As Double
Public Multiplikation As Double
Public Division As Double
'die einzelnen Nummerntasten
Private Sub btn1_Click()
txtInput = txtInput & 1
End Sub
Private Sub btn2_Click()
txtInput = txtInput & 2
End Sub
Private Sub btn3_Click()
txtInput = txtInput & 3
End Sub
Private Sub btn4_Click()
txtInput = txtInput & 4
End Sub
Private Sub btn5_Click()
txtInput = txtInput & 5
End Sub
Private Sub btn6_Click()
txtInput = txtInput & 6
End Sub
Private Sub btn7_Click()
txtInput = txtInput & 7
End Sub
Private Sub btn8_Click()
txtInput = txtInput & 8
End Sub
Private Sub btn9_Click()
txtInput = txtInput & 9
End Sub
Private Sub btn0_Click()
txtInput = txtInput & 0
End Sub
'###hier Problem###
Private Sub btnkomma_Click()
txtInput = txtInput & "."
End Sub
'###bis hier###
'Taste zum Löschen der Eingabe
Private Sub btnLoeschen_Click()
txtInput = ""
Addition = 0
Subtraktion = 0
Multiplikation = 0
Division = 0
End Sub
'Berechnung der Grundrechenarten
Private Sub btnplus_Click()
Addition = txtInput
txtInput = ""
End Sub
Private Sub btnminus_Click()
Subtraktion = txtInput
txtInput = ""
End Sub
Private Sub btnmal_Click()
Multiplikation = txtInput
txtInput = ""
End Sub
Private Sub btndurch_Click()
Division = txtInput
txtInput = ""
End Sub
'Schaltfläche Berechnen
'Abfrage, was gedrückt wurde, über If then
Private Sub btnBerechnen_Click()
Dim Ergebnis As Double
Temporaer = txtInput
If Addition <> Empty Then
Ergebnis = CDbl(Addition) + CDbl(Temporaer)
ElseIf Subtraktion <> Empty Then
Ergebnis = CDbl(Subtraktion) - CDbl(Temporaer)
ElseIf Multiplikation <> Empty Then
Ergebnis = CDbl(Multiplikation) * CDbl(Temporaer)
ElseIf Division <> Empty Then
Ergebnis = CDbl(Division) / CDbl(Temporaer)
End If
'Schreiben des Ergebnisses in Textfeld
txtInput = Ergebnis
Addition = 0
Subtraktion = 0
Multiplikation = 0
Division = 0
Temporaer = txtInput
End Sub
'Button Abbrechen
Private Sub CommandButton18_Click()
UserForm1.Hide
End Sub
Vielen Dank schon ´mal! Chris