Textbox value vergleichen
25.01.2010 08:26:12
Helge Kuehn
Hallo alle zusammen,
Ich brauch mal wieder einen kleinen denkanstoss und zwar geht es um den Teil:
If txt5.Value > txt4.Value Then
MsgBox "Damage Quantity is higher than Balance Quantity!", _
vbCritical, "OzGrid Business Applications"
txt5 = ""
Exit Sub
End If
Wenn in txt4 der wert 12 steht und ich in txt5 2-9 einfuege kommt die Fehlermeldung. Bei dem wert 1 und 11 in der txt5 funktioniert das sub. Wo ist mein Fehler ?
Hier das ganze Makro:
Private Sub txt5_Change()
Dim varRes As Variant
If txt5.Value > txt4.Value Then
MsgBox "Damage Quantity is higher than Balance Quantity!", _
vbCritical, "OzGrid Business Applications"
txt5 = ""
Exit Sub
End If
If txt4 = "" Then
Exit Sub
End If
If txt5 <> "" Then
If IsNumeric(varRes) Then
txt6 = txt3.Value - txt5.Value
Else
txt6 = ""
End If
Else
txt6 = ""
Exit Sub
End If
End Sub