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
| Sub Recup_Valeurs()
Dim f1 As Worksheet, f2 As Worksheet
Dim DerLig_f1 As Long, DerLig_f2 As Long
Dim x As Object
Dim i As Long
Application.ScreenUpdating = False
Set f1 = Sheets("Suivi")
Set f2 = Sheets("Extraction")
f1.Columns("c").ClearContents
DerLig_f1 = f1.Range("A" & Rows.Count).End(xlUp).Row
DerLig_f2 = f2.Range("A" & Rows.Count).End(xlUp).Row
Evenement = ""
For i = 2 To DerLig_f1
If f1.Cells(i, "B") = "Investigation" Then
If f1.Cells(i, "A") <> Evenement Then LigDeb_f2 = 1
Evenement = f1.Cells(i, "A")
Set x = f2.Range(f2.Cells(LigDeb_f2, "A"), f2.Cells(DerLig_f2, "A")).Find(Evenement, LookIn:=xlValues, lookat:=xlWhole)
If Not x Is Nothing Then
f1.Cells(i, "C") = f2.Cells(x.Row, "B")
LigDeb_f2 = x.Row
End If
End If
Next i
Set f1 = Nothing
Set f2 = Nothing
Set x = Nothing
End Sub |
Partager