1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| Private Sub OptionButton1_Click()
ComboBox1.RowSource = "'Feuillededonnées'!A1:a10000"
End Sub
Private Sub OptionButton2_Click()
ComboBox1.RowSource = "'Feuillededonnées'!B1:b10000"
End Sub
pour lancer la recherche, créer un commandbutton:
Private Sub CommandButton1_Click()
Dim x: x = 1: Dim nom: nom = ComboBox1.Value: Dim z: z = 1
If OptionButton1.Value = "Faux" Then GoTo OB2
Do Until Worksheets("Feuillededonnées").Cells(x, 1) = ""
If Worksheets("Feuillededonnées").Cells(x, 1) = nom Then
Worksheets("Feuillededonnées").Rows(x).Copy
UserForm12.Spreadsheet1.Cells(z, 1).Paste
z = z + 1
End If
x = x + 1
Loop
OB2:
If OptionButton2.Value = "Faux" Then GoTo OB3
x = 1
Do Until Worksheets("Feuillededonnées").Cells(x, 2) = ""
If Worksheets("Feuillededonnées").Cells(x, 2) = nom Then
Worksheets("A Feuillededonnées").Rows(x).Copy
UserForm12.Spreadsheet1.Cells(z, 1).Paste
z = z + 1
End If
x = x + 1
Loop
OB3:
End Sub |
Partager