if else problem
21.10.2005 19:05:37
Bernd
zu aller erst: VBA gut nur weil VBA Kentnisse nicht zur verfügung steht.
ich habe mir eine userform gebastelt.
die userform beinhaltet folgenden code:
Private Sub Berechnen()
Dim Eingabe As Double
If TextBox5 <> "" Then
Eingabe = TextBox5
If IsNumeric(TextBox1) Then
If TextBox1 <> "" Then
Eingabe = Eingabe - TextBox1
End If
Else
MsgBox "Keine Zahl"
End If
If IsNumeric(TextBox2) Then
If TextBox2 <> "" Then
Eingabe = Eingabe - TextBox2
End If
Else
MsgBox "Keine Zahl"
End If
If IsNumeric(TextBox3) Then
If TextBox3 <> "" Then
Eingabe = Eingabe - TextBox3
End If
Else
MsgBox "Keine Zahl"
End If
If IsNumeric(TextBox4) Then
If TextBox4 <> "" Then
Eingabe = Eingabe - TextBox4
End If
Else
MsgBox "Keine Zahl"
End If
TextBox6 = Format(Eingabe, "#,##0.00 \'80")
End If
End Sub
Private Sub UserForm_Initialize()
TextBox5 = Format(Sheets("tabelle1").Range("A1"), "#,##0.00 \'80")
TextBox1 = 0
TextBox2 = 0
TextBox3 = 0
TextBox4 = 0
End Sub
nun passiert beim öffnen der UF, dass ersteinmal 5x die msgbox "Keine Zahl"
aufgeht, bevor die UF aufgeht.
kann mir da einer sagen warum?
und kann mann den code evtl. kürzen?
gruss aus dem schönen Hamburg
Bernd
Rückmeldung wäre nett