Anzeige
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Zahleneingabe

Forumthread: Zahleneingabe

Zahleneingabe
22.12.2004 11:42:03
rick
Hallo,
ich will in einem Eingabefenster mit 5 Eingabefeldern jeweils eine Zahl zwischen 1 und 10 eingeben, wobei aber keine Zahl doppelt vorkommen soll, also quasi eine Fehlermeldung erscheint oder die Zahl gar nicht akzeptiert wird, wenn sie bereits in einem vorhergehenden Feld eingegeben wurde.
Hat irgendwer eine Idee dazu?
Gruss
Rick
Anzeige

2
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Zahleneingabe
22.12.2004 11:53:10
Matthias
Hallo Rick,
also wenn es ein UserForm ist:
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox1 < 1 Or TextBox1 > 10 Then Cancel = True
If TextBox1 = TextBox2 Then Cancel = True
If TextBox1 = TextBox3 Then Cancel = True
If TextBox1 = TextBox4 Then Cancel = True
If TextBox1 = TextBox5 Then Cancel = True
If Cancel Then MsgBox "Eingabe ist nicht gültig!"
End Sub
Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox2 < 1 Or TextBox2 > 10 Then Cancel = True
If TextBox2 = TextBox1 Then Cancel = True
If TextBox2 = TextBox3 Then Cancel = True
If TextBox2 = TextBox4 Then Cancel = True
If TextBox2 = TextBox5 Then Cancel = True
If Cancel Then MsgBox "Eingabe ist nicht gültig!"
End Sub
Private Sub TextBox3_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox3 < 1 Or TextBox3 > 10 Then Cancel = True
If TextBox3 = TextBox1 Then Cancel = True
If TextBox3 = TextBox2 Then Cancel = True
If TextBox3 = TextBox4 Then Cancel = True
If TextBox3 = TextBox5 Then Cancel = True
If Cancel Then MsgBox "Eingabe ist nicht gültig!"
End Sub
Private Sub TextBox4_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox4 < 1 Or TextBox4 > 10 Then Cancel = True
If TextBox4 = TextBox1 Then Cancel = True
If TextBox4 = TextBox2 Then Cancel = True
If TextBox4 = TextBox3 Then Cancel = True
If TextBox4 = TextBox5 Then Cancel = True
If Cancel Then MsgBox "Eingabe ist nicht gültig!"
End Sub
Private Sub TextBox5_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox5 < 1 Or TextBox5 > 10 Then Cancel = True
If TextBox5 = TextBox1 Then Cancel = True
If TextBox5 = TextBox2 Then Cancel = True
If TextBox5 = TextBox3 Then Cancel = True
If TextBox5 = TextBox4 Then Cancel = True
If Cancel Then MsgBox "Eingabe ist nicht gültig!"
End Sub

Bei 5 Textboxen ist es noch so zu bewerkstelligen, bei mehr wird es dann aber immer unübersichtlichen...
Gruß Matthias
Anzeige
Danke
22.12.2004 12:41:35
rick
Danke, das hat geholfen
Gruss
Rick
;

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige