bonjour,

lorsque j'utilise la fonction recherche excel me dit qu'il y a une erreur dans
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
  Loop While Not cc Is Nothing And cc.Address <> firstAddress
car cc est vide

mais je comprend pas d'ou vient cette erreur
est ce qu'on ne peut pas faire deux recherches car j'ai deja
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
 
  Set aa = .FindNext(aa)
Loop While Not aa Is Nothing And aa.Address <> afirstAddress

qui se passe sans soucis !


le code de la procédure est
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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

est ce le 'end with ' annule tous les ' with 'precedents?


merci de votre aide