1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Sub toto()
Dim i As Long, k As Long
Sheets("Clients").Range("A2:B200000").ClearContents
dernlig = Sheets("Données SAP").Range("C" & Sheets("Données SAP").Rows.Count).End(xlUp).Row
k = 2
For i = 2 To Sheets("Références").Range("A" & Sheets("Références").Rows.Count).End(xlUp).Row
With Sheets("Données SAP").Range("C1:C" & dernlig)
Set c = .Find(Sheets("Références").Range("A" & i), LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Sheets("Clients").Cells(k, 1) = c.Offset(0, -2)
Sheets("Clients").Cells(k, 2) = c.Value
k = k + 1
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
Next i
End Sub |
Partager