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
| Private Sub CommandButton1_Click()
Dim iL As Long
Dim P As Worksheet
Dim M As Worksheet
Set P = Worksheets("Sheet2")
Set M = Worksheets("Sheet3")
iP2 = Sheet1.Cells(100, 1).Value
If TextBox1.Value <> "" Then
For iL = 1 To 20
If P.Cells(iL, 2).Text = TextBox1.Text Then
P.Rows(iL).Copy M.Cells(iP2, 1)
iP2 = iP2 + 1
End If
Next
M.Select
ElseIf TextBox2.Value <> "" Then
MsgBox "OK text 2"
ElseIf TextBox3.Value <> "" Then
MsgBox "OK text 3"
Else: MsgBox "Rentrer une valeur"
End If
End Sub |