Bonjour à tous je viens vers vous car j'aurais une question posée j'ai trouvais ce code sur Internet mais il y a certaines lignes je n'arrive pas à comprendre leur fonctionne pouvez-vous m'aider s'il vous plaît. Les lignes que je ne comprends pas seront marqués en rouge.
Me.ComboBox1.Text = Me.ComboBox1.List(0)
Me.ComboBox2.Text = Me.ComboBox2.List(0)
Me.ComboBox3.Text = Me.ComboBox3.List(0)
Me.ComboBox1.Text = Me.ComboBox1.List(0)
Me.ComboBox2.Text = Me.ComboBox2.List(0)
Me.ComboBox3.Text = Me.ComboBox3.List(0)
VB:
Private Sub UserForm_Initialize()
With UserForm2
.StartUpPosition = 0
.Top = 190
.Left = 535
End With
'USERFORM2 PREREMPLISSAGE DES COMBOBOXES
dligne = Sheets("Feuil2").Range("A" & Rows.Count).End(xlUp).Row
'Combobox VILLES
Me.ComboBox1.Clear
Me.ComboBox1.AddItem ""
For Each cell In Worksheets("Feuil2").Range("D2:D" & dligne)
Me.ComboBox1 = cell
'remplissage sans doublon
If Me.ComboBox1.ListIndex = -1 Then
Me.ComboBox1.AddItem cell
End If
Next cell
Me.ComboBox1.Text = Me.ComboBox1.List(0)
'Combobox METIERS
Me.ComboBox2.Clear
Me.ComboBox2.AddItem ""
For Each cell In Worksheets("Feuil2").Range("B2:B" & dligne)
Me.ComboBox2 = cell
'remplissage sans doublon
If Me.ComboBox2.ListIndex = -1 Then
Me.ComboBox2.AddItem cell
End If
Next cell
Me.ComboBox2.Text = Me.ComboBox2.List(0)
'Combobox SPORTS
Me.ComboBox3.Clear
Me.ComboBox3.AddItem ""
For Each cell In Worksheets("Feuil2").Range("C2:C" & dligne)
Me.ComboBox3 = cell
'remplissage sans doublon
If Me.ComboBox3.ListIndex = -1 Then
Me.ComboBox3.AddItem cell
End If
Next cell
Me.ComboBox3.Text = Me.ComboBox3.List(0)
End Sub