Hello,
Si j'ai bien compris
Option Compare Text
Sub InsertCode()
Dim Ext As Worksheet: Set Ext = Worksheets("Extraction")
Dim Bdd As Worksheet: Set Bdd = Worksheets("donnée d'entrée")
Dim Bdd_L, J
Dim Ext_D As Range: Set Ext_D = Ext.Cells.Find("code PSA", lookat:=xlPart).Offset(1) ' première cellule de la table extraction
Dim Ext_F As Range: Set Ext_F = Ext.Cells(Ext.Rows.Count, "D").End(xlUp) ' dernière cellule de la table extraction
Dim Bdd_D As Range: Set Bdd_D = Bdd.Cells.Find("code PSA", lookat:=xlPart).Offset(1) ' première cellule de la table Bdd
Dim Bdd_F As Range:
Dim Cols As Integer: Cols = 9 ' Nombre de colonnes à copier
For J = Ext_D.Row To Ext_F.Row
'Copier juste les colonnes 'OUI'
If Ext.Rows(J).Columns("K") = "Oui" Then
Set Bdd_F = Bdd.Cells(Bdd.Rows.Count, "B").End(xlUp).Offset(1) ' Ligne Bdd disponible pour ajout
If Bdd_F.Row < Bdd_D.Row Then Set Bdd_F = Bdd.Cells(Bdd_D.Row, "B")
' On recherche le code dans la colonne en partant du bas
Set Bdd_L = Bdd.Columns("D").Find(Ext.Cells(J, "D"), _
LookIn:=xlValues, lookat:=xlWhole)
If Bdd_L Is Nothing Then
Bdd.Cells(Bdd_F.Row, "B").Resize(, Cols).Borders.LineStyle = xlContinuous
With Bdd.Rows(Bdd_F.Row)
.Columns("B") = Ext.Rows(J).Columns("B")
.Columns("C") = Ext.Rows(J).Columns("C")
.Columns("D") = Ext.Rows(J).Columns("D")
.Columns("G") = Ext.Rows(J).Columns("G")
End With
End If
End If
Next
End Sub