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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
Workbooks("coordonnees.xls").Sheets("recherche").Activate
Range("C2").Select
Do While Not IsEmpty(ActiveCell)
nom = ActiveCell.Value
prenom = ActiveCell.Offset(0, 1).Value
Workbooks("coordonnees.xls").Sheets("contact").Activate
With Worksheets("contact").Range("B1:B" & Cells(Rows.Count, 2).End(xlUp).Row)
Set cc = .Find(nom, LookIn:=xlValues, lookat:=xlWhole)
If Not cc Is Nothing Then
firstAddress = cc.Address
Do
If cc.Offset(0, 1) = prenom Then
Workbooks("coordonnees.xls").Sheets("recherche").Activate
With Worksheets("recherche").Range("c1:C" & Cells(Rows.Count, 3).End(xlUp).Row)
Set aa = .Find(nom, LookIn:=xlValues, lookat:=xlWhole)
If Not aa Is Nothing Then
afirstAddress = aa.Address
Do
If aa.Offset(0, 1) = prenom Then
aa.Offset(0, 3).Value = cc.Offset(0, 4).Value
End If
Set aa = .FindNext(aa)
Loop While Not aa Is Nothing And aa.Address <> afirstAddress
End If
End With
Set aa = Nothing
End If
Set cc = .FindNext(cc)
Loop While Not cc Is Nothing And cc.Address <> firstAddress
End If
End With
Set cc = Nothing |
Partager