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 41 42 43 44 45 46 47 48 49
|
Private Sub CommandButton1_Click()
Dim i As Integer
If Not TextBox1.Value = "" Then
Sheets("BDD").Select
Range("C65536").End(xlUp).Select
maxfor = Range("C65536").End(xlUp).Row
Z = 0
i = 8
x = 0
If Cells(i, 3).Value = TextBox1.Value Then
Range("C" & i & ":M" & i).Select
Selection.Copy
Sheets("colle").Select
Selection.PasteSpecial Paste:=xlPasteAllExceptBorders, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
End If
Do Until i = maxfor
i = i + 1
x = x + 1
If Cells(i, 3).Value = TextBox1.Value Then
Range("C" & i & ":M" & i).Select
Selection.Copy
Sheets("colle").Select
Range("C" & x).Select
Selection.PasteSpecial Paste:=xlPasteAllExceptBorders, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("BDD").Select
End If
Loop
Else
MsgBox "Tapez un nom", vbExclamation + vbOKOnly, ""
TextBox1.SetFocus
x = 1
End If
If x = 0 Then
MsgBox "Rien trouvé", vbExclamation + vbOKOnly, ""
End If
End Sub |
Partager