Autotab textbox using loops anf if
soprano221
Messages postés
6
Statut
Membre
-
soprano221 Messages postés 6 Statut Membre -
soprano221 Messages postés 6 Statut Membre -
hello i wanted to autotab my userform in a specific bunch of textbox. i do know the code for t it beetween 2 textbox but what if we have many textbox and we dont want to start necessarily from the first one like we want to start for example from the 5th textbox. Guess we have to use loops and if but how please i need help
the code beetween two textbox goes like this under:
Private Sub TextBox1_Change()
2
'whenever there are 6 characters registered in the TextBox
3
If TextBox1.TextLength = 6 Then
4
'select (SetFocus) the next TextBox
5
TextBox2.SetFocus
6
End If
thank u all!
the code beetween two textbox goes like this under:
Private Sub TextBox1_Change()
2
'whenever there are 6 characters registered in the TextBox
3
If TextBox1.TextLength = 6 Then
4
'select (SetFocus) the next TextBox
5
TextBox2.SetFocus
6
End If
thank u all!
1 réponse
-
Bonjour,
ç'aurait été sympa que tu poses ta question en français.
Il semble que tu cherches à passer, dans un UserForm, d'un TextBox au suivant une fois qu'il y a 6 caractères dans le premier.
Je propose :Private Sub TextBox1_Change() Call Verif("TextBox1", "TextBox2") End Sub Private Sub Verif(ori As String, dest As String) If Controls(ori).TextLength = 6 Then Controls(dest).SetFocus End Sub
avec Verif, que tu peux appeler depuis chaque TextBoxN_Change()
A+