Private Sub Worksheet_Change(ByVal Target As Range)
Dim Targe_2 As Range
On Error GoTo errorHandler
' définir une cellule hors du tableau
Set Target2 = Worksheets("Résumé").Range("DD1000")
If Not Intersect(Target, Range("J27")) Is Nothing Or Not Intersect(Target, Range("H28")) Is Nothing Or Not Intersect(Target, Range("I29")) Is Nothing Or Not Intersect(Target, Range("A31")) Is Nothing Then
Hauteur_T2 = Target2.RowHeight
Largeur_T2 = Target2.ColumnWidth
Target.MergeArea.WrapText = True
Target2.MergeArea.WrapText = True
Target2.Font.Name = Target.Font.Name
Target2.Font.Size = Target.Font.Size
If Target.MergeCells Then
With Target2
For j = 1 To 3
.ColumnWidth = Target.MergeArea.Width / .Width * .ColumnWidth
Next j
End With
End If
Target2.Value = Target
Target2.Rows.AutoFit
Target.RowHeight = Target2.RowHeight
Target2.Clear
Target2.RowHeight = Hauteur_T2
Target2.ColumnWidth = Largeur_T2
End If
Exit Sub
errorHandler:
Set Target2 = Worksheets("Résumé").Range("DD1000")
Target.RowHeight = Target2.RowHeight
End Sub