si texbox1 est remplie alors textbox2

geraldvc

XLDnaute Junior
difficulter enfin pour moi!!!



Le principe est : Texbox1,Combobox1,Textbox2,Textebox3, doivent être inscrite, dans la feuil2 dans une listbox1 et dans mes Textebox nommée nbr1 nbr2 ainsi de suite jusque 14 et idem pour Combobox1,Textbox2,Textebox3.

En espèrent que vous m'avez compris.



ici j'arrive qu'elles s'inscrivent dans l'un ou dans l'autre mais pas partout !!!
on me parle d'indéxer ? comment faire?




Private Sub Enregistré_Click() 'Bibliothèque

Dim Nb As Integer, Dnb As Integer, i As Integer, Y As String
Dim Element_Select As String
Dnb = Sheets("feuil2").Range("E2").Value
Nb = UserForm2.ListBox1.ListCount
Element_Select = False
Sheets("feuil2").Activate
Y = 3 'Sur Feuil2 ligne de départ de la bibli ----> "A3"

For i = 0 To Nb - 1
If UserForm2.ListBox1.Selected(i) = True Then
Element_Select = True
Range("a" & i + Y).Value = TextBox1
Range("b" & i + Y).Value = ComboBox1
Range("c" & i + Y).Value = TextBox2
Range("d" & i + Y).Value = TextBox1
With Range("d" & i + Y)
.HorizontalAlignment = xlHAlignRight
.VerticalAlignment = xlVAlignCenter
With .Font
.Size = 8
.Italic = False
.Bold = False
.Name = "Arial"
End With
End With
End If
Next

If Element_Select = False Then
Range("a" & Dnb + Y).Value = TextBox1
Range("b" & Dnb + Y).Value = ComboBox1
Range("c" & Dnb + Y).Value = TextBox2
Range("d" & Dnb + Y).Value = TextBox3
With Range("d" & i + Y)
.HorizontalAlignment = xlHAlignRight
.VerticalAlignment = xlVAlignCenter
End With
Dnb = Dnb + 2
ElseIf TextBox2 = "" Then
Dnb = Dnb - 1
For J = 0 To Nb + 3
If "" = Range("b" & J + Y).Value Then 'supprime ligne vide
Range("b" & J + Y).Select
For X = -1 To 2
Range("b" & J + Y).Offset(0, X) = Range("b" & J + Y).Offset(1, X).Value
Range("b" & J + Y).Offset(1, X).Value = Clear
Next
End If
Next
Else
End If
TextBox1 = Clear
ComboBox1 = Clear
TextBox2 = Clear
TextBox3 = Clear
Call box1
Dnb = Sheets("feuil2").Range("E2").Value


'transfert nbr
If nbr1.Text = vbNullString Then
nbr1.Text = TextBox1.Text
Exit Sub
ElseIf nbr2.Text = vbNullString Then
nbr2.Text = TextBox1.Text
Exit Sub
ElseIf nbr3.Text = vbNullString Then
nbr3.Text = TextBox1.Text
Exit Sub
ElseIf nbr4.Text = vbNullString Then
nbr4.Text = TextBox1.Text
Exit Sub
ElseIf nbr5.Text = vbNullString Then
nbr5.Text = TextBox1.Text
Exit Sub
ElseIf nbr6.Text = vbNullString Then
nbr6.Text = TextBox1.Text
Exit Sub
ElseIf nbr7.Text = vbNullString Then
nbr7.Text = TextBox1.Text
Exit Sub

ElseIf nbr8.Text = vbNullString Then
nbr8.Text = TextBox1.Text
Exit Sub
ElseIf nbr9.Text = vbNullString Then
nbr9.Text = TextBox1.Text
Exit Sub
ElseIf nbr10.Text = vbNullString Then
nbr10.Text = TextBox1.Text
Exit Sub
ElseIf nbr11.Text = vbNullString Then
nbr11.Text = TextBox1.Text
Exit Sub
ElseIf nbr12.Text = vbNullString Then
nbr12.Text = TextBox1.Text
Exit Sub
ElseIf nbr13.Text = vbNullString Then
nbr13.Text = TextBox1.Text
Exit Sub
ElseIf nbr14.Text = vbNullString Then
nbr14.Text = TextBox1.Text
Exit Sub
'fransfert article
If article1.Text = vbNullString Then
article1.Text = ComboBox1.Text
Exit Sub
ElseIf article2.Text = vbNullString Then
article2.Text = ComboBox1.Text
Exit Sub
ElseIf article3.Text = vbNullString Then
article3.Text = ComboBox1.Text
Exit Sub
ElseIf article4.Text = vbNullString Then
article4.Text = ComboBox1.Text
Exit Sub
ElseIf article5.Text = vbNullString Then
article5.Text = ComboBox1.Text
Exit Sub
ElseIf article6.Text = vbNullString Then
article6.Text = ComboBox1.Text
Exit Sub
ElseIf article7.Text = vbNullString Then
article7.Text = ComboBox1.Text
Exit Sub

ElseIf article8.Text = vbNullString Then
article8.Text = ComboBox1.Text
Exit Sub
ElseIf article9.Text = vbNullString Then
article9.Text = ComboBox1.Text
Exit Sub
ElseIf article10.Text = vbNullString Then
article10.Text = ComboBox1.Text
Exit Sub
ElseIf article11.Text = vbNullString Then
article11.Text = ComboBox1.Text
Exit Sub
ElseIf nbr12.Text = vbNullString Then
article12.Text = ComboBox1.Text
Exit Sub
ElseIf article13.Text = vbNullString Then
article13.Text = ComboBox1.Text
Exit Sub
ElseIf article14.Text = vbNullString Then
article14.Text = ComboBox1.Text
Exit Sub



If Element_Select = True Then
For i = 0 To ListBox1.ListCount - 1
ListBox1.Selected(i) = False
TextBox1 = Clear
ComboBox1 = Clear
TextBox2 = Clear
TextBox2 = Clear
Next i
MsgBox "Toutes les zones de saisie sont remplies !"
Else
End If
End If
End If
End Sub
 

Discussions similaires

Réponses
12
Affichages
654

Statistiques des forums

Discussions
314 058
Messages
2 105 121
Membres
109 272
dernier inscrit
V@n