Bonjour,
Si j'ai bien compris ton propos et selon l'ébauche de la macro "numequipe" > il pourait y avoir dans la feuille "BASE DE SAISIE" deux adresses mail différentes (un peu ou très différentes) se rapportant au même agent ...
Si c'est bien le cas > j'ai construit mon code correctement ...
Le principe > 3 array > AgentNom, AgentModif, AgentPseudo ...
Les 3 doivent être synchronisés > i.e. : AgentNom en 3e position correspond à l'AgentModif en 3e position et correspond aussi à l'AgentPseudo en 3e position ...
Toujours selon la 3e position > "frank" ou "frank@frank.net ou "3" doivent se suivre ...
Ou encore > "phillip.morice@cel.fr" ou "phillipe.morice@cel.fr" ou "LO-C1" ...
Examine cela > si tu y comprends quelque chose et > dans l'affirmative > si cela te convient ...
Si tu augmentais le nombre d'agents > en ajoutant les infos pertinentes dans les 3 array > le code devrait continuer à bien fonctionner ...
Sub numequipe()
Dim Cel As Range
Dim Agt As Integer
Dim AgentNom, AgentModif, AgentPseudo
Application.ScreenUpdating = False
AgentNom = Array("hubert@excel.fr", "josianne@excel.fr", "frank", "nicolas", "théo", "phillip.morice@excel.fr", "jean neymard", "david adata", "isa belle", "jean néplin")
AgentModif = Array("hubert@excel.fr", "josianne@excel.fr", "frank@frank.net", "nicolas@nic.com", "théo", "phillip.morice@cel.fr", "jean neymard", "david adata", "isa belle", "jean néplin")
AgentPseudo = Array("1", "2", "3", "4", "5", "LO-C1", "LO-C2", "LO-C3", "LO-C42", "LO-C5")
With Sheets("BASE DE SAISIE")
.Activate
If .FilterMode = True Then .ShowAllData
For Each Cel In Range("AL24", Range("AL" & Rows.Count).End(xlUp))
If Cel <> "" Then
For Agt = LBound(AgentNom) To UBound(AgentNom)
If AgentNom(Agt) = Cel Or AgentModif(Agt) = Cel Then
.Cells(Cel.Row, "A") = AgentPseudo(Agt)
Exit For
End If
Next Agt
Else
.Cells(Cel.Row, "A").ClearContents
End If
Next Cel
End With
Sheets("Feuil1").Activate
End Sub
ric