Hallo!
Ich habe ein Problem mit dem SetFocus in einer Userform
Meine Userform beinhaltet:
TextBox1 TabIndex 0
CheckBox1 TabIndex 1
TextBox2 TabIndex 2
TextBox3 TabIndex 3
TextBox4 TabIndex 4
In dieser Userform möchte ich wenn ich CheckBox1 anklicke auf Checkbox 4 springen
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
TextBox4.SetFocus
End If
End Sub
das funktioniert noch. Es funktioniert auch in späterer Folge, wenn ich CheckBox1 aus und wieder anklicke.
Jetzt kommt mein Problem!
Ich möchte, wenn ich mit Tabulator weiterspringe und zu Checkbox1 komme und diese bereits value=true gesetzt ist automatisch zu Textbox4 springt.
Private Sub CheckBox1_Enter()
If CheckBox1.Value = True Then
TextBox4.SetFocus
End If
End Sub
Und da ist das Problem: Er setzt den Focus auf TextBox2.
Gehe ich den Code im Debuggmodus durch passt alles bis zu „End Sub“.
Bis dorthin ist SetFocus auf TextBox4, nach Beendigung der Sub springt er auf TextBox2.
Ich hoffe, ich habe mein Problem gut beschrieben und jemand kann mir helfen!
Danke im vorhinein!