Sub Modifier_client()
Dim w As Worksheet, c As Range, i&, client$, lig&, fichier$, cc As Range, n&
Set w = Sheets("Feuil1")
If Application.CountIf(w.[F:F], "X") = 0 Then Exit Sub
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each c In w.[F:F].SpecialCells(xlCellTypeConstants)
If UCase(c) = "X" Then
i = c.Row
client = w.Cells(i, 4)
lig = Val(w.Cells(i, 5))
If lig <= 0 Then
w.Cells(i, 6) = ""
Else
fichier = w.Cells(i, 1).Hyperlinks(1).Address
If Dir(fichier) = "" Then fichier = ThisWorkbook.Path & "\" & fichier
With Workbooks.Open(fichier).Sheets(1) 'ouvre le fichier
Set cc = .Cells.Find("AFFAIRE/CLIENT")
If cc Is Nothing Then
w.Cells(i, 6) = ""
Else
n = n + 1
.Cells(lig, cc.Column) = client
End If
.Parent.Close Not cc Is Nothing 'enregistre et ferme le fichier
End With
End If
End If
Next
MsgBox n & " cellule(s) modifiée(s) dans les fichiers sources"
End Sub