brauche bitte eure Hilfe.
Ich habe mir folgendes VBA erstellt, in dem ich bei einer Textbox nur Zahlen, Bckspace und Minuszeichen zulasse. Gibt es eine Möglichkeit, dass ich noch Prüfe, dass das Minuszeichen (wegen Negativbetrag) NUR einmal an der ersten Stelle eingegeben werden darf?
Private Sub Zahleneingabe(KeyAscii)
' nur Ziffern und Komma können in Textbox eingegeben
' Punkte als "," umwandeln
If KeyAscii = Asc(".") Then KeyAscii = Asc(",")
' Nur Ziffern und Rückschritt erlaubt
If KeyAscii Asc("1") And KeyAscii Asc("2") And _
KeyAscii Asc("3") And KeyAscii Asc("4") And _
KeyAscii Asc("5") And KeyAscii Asc("6") And _
KeyAscii Asc("7") And KeyAscii Asc("8") And _
KeyAscii Asc("9") And KeyAscii Asc(",") And _
KeyAscii vbKeyBack And KeyAscii Asc("0") And _
KeyAscii Asc("-") Then
KeyAscii = 0
End If
' Nur EIN Komma erlaubt
If InStr(1, TextBox2.Text, ",") 0 And KeyAscii = Asc(",") Then KeyAscii = 0
..
Vielen Dank für Eure Hilfe!!
Schönen Abend noch.
lg
Spillo