Private Sub CommandButton1_Click()
Sheets("tb").Range("B12:K" & Sheets("tb").Range("B65535").End(xlUp).Row + 1).ClearContents
Sheets("tb1").Range("B12:K" & Sheets("tb1").Range("B65535").End(xlUp).Row + 1).ClearContents
Sheets("tb2").Range("B12:K" & Sheets("tb2").Range("B65535").End(xlUp).Row + 1).ClearContents
With Sheets("INFO")
For i = 3 To .Range("A1048576").End(xlUp).Row
If .Cells(i, 10) = "J" Then
derligne = Sheets("tb").Range("B1048576").End(xlUp).Row + 1
.Range(.Cells(i, 1), .Cells(i, 9)).Copy Destination:=Sheets("tb").Cells(derligne, 2)
.Cells(i, 10).Copy Destination:=Sheets("tb").Cells(derligne, 10) ' copie de la cellule en colonne J
End If
If .Cells(i, 11) = "J" Then
derligne = Sheets("tb1").Range("B1048576").End(xlUp).Row + 1
.Range(.Cells(i, 1), .Cells(i, 9)).Copy Destination:=Sheets("tb1").Cells(derligne, 2)
.Cells(i, 11).Copy Destination:=Sheets("tb1").Cells(derligne, 10) ' copie de la cellule en colonne K
End If
If .Cells(i, 12) = "J" Then
derligne = Sheets("tb2").Range("B1048576").End(xlUp).Row + 1
.Range(.Cells(i, 1), .Cells(i, 9)).Copy Destination:=Sheets("tb2").Cells(derligne, 2)
.Cells(i, 12).Copy Destination:=Sheets("tb2").Cells(derligne, 10) ' copie de la cellule en colonne K
End If
Next i
End With
MsgBox ("La répartition est terminée")
End Sub