ich habe eine Userform mit 4 Textboxes und 2 Comboboxes.
Nun möchte ich eine Prüfung aufbauen, dass nur eine TextBox oder ComboBox geändert werden darf.
Wenn keine Änderung der Textbox oder ComboBox getätigt wurde und der OptionButton4 gewählt wird, wird der nachstehene Code abgefragt:
'alles gleich
Private Sub OptionButton4_Click()
If TextBox1.Value = TextBox11.Value And TextBox2.Value = TextBox12.Value And ComboBox1. _
Value = ComboBox5.Value _
And ComboBox4.Value = ComboBox6.Value And TextBox4.Value = TextBox14.Value And _
TextBox5.Value = TextBox15.Value Then
' MsgBox "alle Werte gleich - Abbruch"
Label18.Caption = "es wurde keine Änderung vorgenommen!"
CommandButton4.Enabled = False
OptionButton4 = False
'2 Änderungen nicht möglich TB11 und TB12
ElseIf TextBox1.Value TextBox11.Value And TextBox2.Value TextBox12.Value And _
ComboBox1.Value = ComboBox5.Value _
And ComboBox4.Value = ComboBox6.Value And TextBox4.Value = TextBox14.Value And _
TextBox5.Value = TextBox15.Value Then
' MsgBox "alle Werte gleich - Abbruch"
Label18.Caption = "es wurden zwei Änderung vorgenommen!"
CommandButton4.Enabled = False
OptionButton4 = False
Call OptionButton3_Click
... usw.
End if
End sub
Nun möchte ich, dass alle Felder abgefragt werden, die nur 1 geändertes Feld besitzt, dann wenn 2 geändert wurden, wenn 3 geändert wurden und wenn 5 geändert wurde.Gibt es hierfür eine Lösung, mit welcher nicht für jede einzelne Variante ein eigener Code geschrieben werden muss?
Gruss
Peter