5 – La possibilité de joindre des fichiers est donnée sur ce forum. Ne pas hésiter à utiliser cette fonction, tout en veillant que les données soient bidons et donc qu’aucune donnée confidentielle, nominative ne soit dans le fichier.
Private Sub CommandButton6_Click()
Dim no_ligne As Long
no_ligne = ComboBox3.ListIndex + 2
TextBox1 = Cells(no_ligne, 1).Value
TextBox2 = Cells(no_ligne, 2).Value
TextBox3 = Cells(no_ligne, 3).Value
TextBox4 = Cells(no_ligne, 4).Value
ComboBox1 = Cells(no_ligne, 5).Value
TextBox5 = Cells(no_ligne, 6).Value
TextBox6 = Cells(no_ligne, 7).Value
TextBox7 = Cells(no_ligne, 8).Value
ComboBox2 = Cells(no_ligne, 9).Value
TextBox8 = Cells(no_ligne, 10).Value
End Sub
Private Sub UserForm_Initialize()
With Sheets("Base")
ComboBox3.List = Range(.Cells(2, 1), .Cells(Rows.Count, 1).End(xlUp)).Value
End With
End Sub
Private Sub CommandButton6_Click()
Dim arCTRL, i%, no_ligne&
arCTRL = Array("TextBox1", "TextBox2", "TextBox3", "TextBox4", "ComboBox1", "TextBox5", "TextBox6", "TextBox7", "Combobox2", "TextBox8")
no_ligne = ComboBox3.ListIndex + 2
For i = 0 To 9
Controls(CStr(arCTRL(i))) = Cells(no_ligne, i + 1)
Next i
End Sub