Dim Tableau() As String Dim Toto As String Dim i As Integer Toto = "AAAA666666-1" Tableau = Split(Toto, "-") TextBox3.Text = Tableau(1) Toto = Tableau(0) For i = 1 To Len(Toto) If IsNumeric(Mid(Toto, i, 1)) Then TextBox1.Text = Left(Toto, i - 1) TextBox2.Text = Right(Toto, Len(Toto) - i + 1) Exit For End If Next
toto = "AAAA666666-1" For i = 1 To Len(toto) lu = Mid(toto, i, 1) If Not IsNumeric(lu) And lu <> "-" Then titi1 = Mid(toto, 1, i) ou = i ElseIf lu = "-" Then titi2 = Mid(toto, ou + 1, i - 1 - ou) titi3 = Mid(toto, i + 1) End If Next MsgBox titi1 & vbCrLf & titi2 & vbCrLf & titi3
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionDim Toto, Tata As String Dim i As Integer Toto = "AAAA666666-1" Toto = Replace(Toto, "-", " ") i = 1 Do While Not IsNumeric(Mid(Toto, i, 1)) Tata = Tata & Mid(Toto, i, 1) i = i + 1 Loop Toto = Tata & " " & Right(Toto, (Len(Toto) - i + 1)) MsgBox Split(Toto)(0) MsgBox Split(Toto)(1) MsgBox Split(Toto)(2)
Dim Toto As String Dim i As Integer Toto = "AAAA666666-1" TextBox1.Text = "" TextBox2.Text = "" For i = 1 To Len(Toto) If Mid(Toto, i, 1) = "-" Then TextBox3.Text = Mid(Toto, i + 1, 1) Exit For End If If IsNumeric(Mid(Toto, i, 1)) Then TextBox2.Text = TextBox2.Text & Mid(Toto, i, 1) Else TextBox1.Text = TextBox1.Text & Mid(Toto, i, 1) End If Next
UserForm3.TextBox4 = Left(Feuil11.Cells(lig, 1), 4) UserForm3.TextBox5 = Mid(Feuil11.Cells(lig, 1), 5, [6]) UserForm3.TextBox6 = Right(Feuil11.Cells(lig, 1), 1)
UserForm3.TextBox6 = Mid(Feuil11.Cells(lig, 1), 12)
toto = array(4,6,10,1,5,12) For i = 4 to 6 userform3.controls("TextBox" & i)=mid(cells(lig,1),i) next
titi = Array(0, 4, 6, 10, 1, 5, 12) For i = 4 To 6 userform3.Controls("TextBox" & i) = Mid(toto, titi(i), titi(i - 3)) Next
titi = Array(0, 4, 6, 10, 1, 5, 12) For i = 4 To 6 userform3.Controls("TextBox" & i) = Mid(cells(lig,1), titi(i), titi(i - 3)) Next
UserForm3.TextBox6 = Mid(Feuil11.Cells(lig, 1), 12)
(juste pour le cas où le dernier nombre, après le tiret, serait un jour supérieur à 9)Ah oui, bien vu, sait-on jamais !
UserForm3.TextBox4 = Left(Feuil11.Cells(lig, 1), 4) UserForm3.TextBox5 = Mid(Feuil11.Cells(lig, 1), 5, [6]) UserForm3.TextBox6 = Right(Feuil11.Cells(lig, 1), 1) Sheets("Bases_Containers").Rows(lig).Delete
Mais si une vraie correction utile devait être faite, ce serait celle-là :Oups, j'ai zappé le .text Oui, effectivement, toujours renseigner quant à la nature du contenu de la cellule.
userform3.Controls("TextBox" & i).text = Mid(cells(lig,1).text, titi(i), titi(i - 3))
Il n'est absolument pas utile d'ajouter ce suffixe dans ce cas-là.
Pourquoi ? Cherche. Tu vas trouver.