ich habe ein problem mit dem addieren von drei textboxen das ergebnis soll dann in einem label angezeigt werden.
folgende anweisung habe ich geschrieben:
Private Sub TextBox4_Change()
If Len(TextBox4.Text) = 0 Then Exit Sub
If Not IsNumeric(TextBox4.Text) Then
Beep
MsgBox "Nur Zahlen bitte!"
TextBox4.Text = ""
End If
If TextBox4 = "" Then Exit Sub
If Not IsNumeric(TextBox4) Then
SendKeys "{BS}"
Beep
Else
If TextBox5 <> "" Then
Label14.Caption = CDbl(Mid(TextBox4, 1, 6)) + CDbl(Mid(TextBox5, 1, 6)) + CDbl(Mid(TextBox6, 1, 6))
Else
Label14.Caption = CDbl(Mid(TextBox4, 1, 6))
End If
End If
Worksheets("Statistik").Range("G33") = Label14.Caption
Worksheets("Statistik").Range("D33") = TextBox4
End Sub
Private Sub TextBox5_Change()
If Len(TextBox5.Text) = 0 Then Exit Sub
If Not IsNumeric(TextBox5.Text) Then
Beep
MsgBox "Nur Zahlen bitte!"
TextBox5.Text = ""
End If
If TextBox5 = "" Then Exit Sub
If Not IsNumeric(TextBox5) Then
SendKeys "{BS}"
Beep
Else
If TextBox6 <> "" Then
Label14.Caption = CDbl(Mid(TextBox4, 1, 6)) + CDbl(Mid(TextBox5, 1, 6)) + CDbl(Mid(TextBox6, 1, 6))
Else
Label14.Caption = CDbl(Mid(TextBox5, 1, 6))
End If
End If
Worksheets("Statistik").Range("G33") = Label14.Caption
Worksheets("Statistik").Range("E33") = TextBox5
End Sub
Private Sub TextBox6_Change()
If Len(TextBox6.Text) = 0 Then Exit Sub
If Not IsNumeric(TextBox6.Text) Then
Beep
MsgBox "Nur Zahlen bitte!"
TextBox6.Text = ""
End If
If TextBox4 = "" Then Exit Sub
If Not IsNumeric(TextBox4) Then
SendKeys "{BS}"
Beep
Else
If TextBox5 <> "" Then
Label14.Caption = CDbl(Mid(TextBox4, 1, 6)) + CDbl(Mid(TextBox5, 1, 6)) + CDbl(Mid(TextBox6, 1, 6))
Else
Label14.Caption = CDbl(Mid(TextBox6, 1, 6))
End If
End If
Worksheets("Statistik").Range("G33") = Label14.Caption
Worksheets("Statistik").Range("F33") = TextBox6
End Sub
das problem ist das die summe erst nach eingabe in die textbox6 richtig angezeigt wird. was mach ich verkehrt?
kann mir einer helfen?
im voraus danke!
gruß
martin