Bonjour,

j'ai un code qui copier des colonnes de la feuille 1 vers la feuille2 sous condition:

Je vous l'adapter à mon fichier excel et je ne sais pas comment :

- la colonne ou se trouve "oui" (If LCase(datas(lig, 16)) = "oui") est "BB"
- L'identifiant des lignes de la feuille1 se trouve a la colonne BD
- L'identifiant des lignes de la feuille1 se trouve a la colonne A
- les colonnes à copier de la feuille1 sont : K, L, M et N vers les colonnes H, I, J, K de la feuille2


Sub maj()
Dim derlig As Long, lig As Long, col As Long, datas As Variant
Dim sh1 As Worksheet, sh2 As Worksheet, c As Range
Dim cpt1 As Long, cpt2 As Long, inconnu As Long, msg As String
Set sh1 = Sheets("Feuil1")
Set sh2 = Sheets("Feuil2")

'recup datas
With sh1
derlig = .Cells(Rows.Count, "A").End(xlUp).Row
datas = .[A2].Resize(derlig - 1, 16)
End With

' traitement
Application.ScreenUpdating = False
For lig = 1 To UBound(datas)
If LCase(datas(lig, 16)) = "oui" Then
cpt1 = cpt1 + 1
Set c = sh2.[A:A].Find(datas(lig, 1), LookIn:=xlValues, Lookat:=xlWhole)
If c Is Nothing Then
inconnu = inconnu + 1
Else
sh2.Cells(c.Row, 8) = datas(lig, 11)
sh2.Cells(c.Row, 9) = datas(lig, 12)
sh2.Cells(c.Row, 10) = datas(lig, 13)
sh2.Cells(c.Row, 11) = datas(lig, 14)
sh2.Cells(c.Row, 14) = Now
End If
Else
cpt2 = cpt2 + 1
End If
Next lig
msg = "Oui : " & vbTab & cpt1 & vbLf
msg = msg & "Autres : " & vbTab & cpt2 & vbLf & vbLf
msg = msg & "Références 'Oui' non trouvées : " & inconnu
MsgBox msg
End Sub

Merci de votre aide.