Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Source As Range)
Dim fichdest As String, htablo As Long, n As Object, nom As String, plage As Range
fichdest = "Destination(1).xls" [COLOR="Red"]'nom à adapter[/COLOR]
htablo = 200 [COLOR="red"]'hauteur maximum des tableaux, à adapter[/COLOR]
Application.ScreenUpdating = False
On Error Resume Next
'---Ouverture du fichier s'il n'est pas ouvert---
If IsError(Workbooks(fichdest).Name) Then
Err = 0
Workbooks.Open ThisWorkbook.Path & "\" & fichdest 'si les 2 fichiers sont dans le même dossier
If Err Then MsgBox "'" & fichdest & "' introuvable...": Exit Sub
End If
ThisWorkbook.Activate
'---Copie des champs---
For Each n In ThisWorkbook.Names
nom = n.Name
Set plage = Nothing 'sécurité...
Set plage = Range(nom).Resize(htablo)
If Not Intersect(Source, plage) Is Nothing Then
Workbooks(fichdest).Activate
Range(nom).Resize(htablo) = plage.Value
ThisWorkbook.Activate
End If
Next
Application.ScreenUpdating = True
End Sub