Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, [B1]) Is Nothing Then Exit Sub
Dim cible$, chemin$, fichier, feuille$, plage As Range, lig&, col As Range, x$, n&
cible = Right([B1], 9) 'à adapter
chemin = ThisWorkbook.Path & "\" 'à adapter
fichier = Dir(chemin & "isiTel*.xlsb") '1er fichier du dossier
feuille = "Appels"
Set plage = [D1:G10000] 'référence de la plage de recherche à adapter
lig = 2
Application.ScreenUpdating = False
Application.EnableEvents = False
While fichier <> ""
x = chemin & "[" & fichier & "]" & feuille & "'!"
For Each col In plage.Columns
n = 0
Do 'boucle pour rechercher toutes les occurrences
Cells(lig, 6).FormulaArray = "=MATCH(""*" & cible & """,""""&'" & x & col.Offset(n).Address & ",0)" 'formule matricielle
If IsError(Cells(lig, 6)) Then Exit Do
n = n + Cells(lig, 6)
Cells(lig, 4) = fichier
Cells(lig, 5) = feuille
Cells(lig, 7) = "=INDEX('" & x & col.Address & "," & n & ")"
Cells(lig, 7) = Cells(lig, 7).Value 'supprime la formule
Cells(lig, 7).NumberFormat = "General" 'format Standard
Cells(lig, 6) = Split(col.Address, "$")(1) & n 'adresse qui écrase la formule
lig = lig + 1
Loop
Next col
fichier = Dir 'fichier suivant
Wend
Range("D" & lig & ":G" & Rows.Count).ClearContents 'RAZ
Application.EnableEvents = True
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim chemin$, lig&, wb As Workbook
chemin = ThisWorkbook.Path & "\" 'à adapter
lig = Target.Row
On Error Resume Next
Set wb = Workbooks(CStr(Cells(lig, 4)))
If wb Is Nothing Then Set wb = Workbooks.Open(chemin & Cells(lig, 4))
Application.EnableEvents = False
With wb.Sheets(CStr(Cells(lig, 5))).Range(Cells(lig, 6))
Application.Goto .Cells(1, 2 - .Column), True 'cadrage
.RowHeight = 55
End With
Application.EnableEvents = True
If wb Is Nothing And Cells(lig, 4) <> "" And lig > 1 Then Cancel = True: MsgBox "Fichier '" & Cells(lig, 4) & "' introuvable !", 48
End Sub