Private Sub Worksheet_Change(ByVal Target As Range)
Dim t As Range
Set t = Intersect(Target, [F5:S5,AA5:AM5])
If Not t Is Nothing Then Ajustement t, [F:S], [AA:AM], xlCenter
Set t = Intersect(Target, [E9:AM9])
If Not t Is Nothing Then Ajustement t, [E:AM], [E:AM], xlCenter
Set t = Intersect(Target, [B14:Q40,AE14:AM40])
If Not t Is Nothing Then Ajustement t, [B:Q], [AE:AM], xlGeneral
End Sub
Sub Ajustement(t As Range, plage1 As Range, plage2 As Range, align)
Dim r1 As Range, r2 As Range, h As Double
Application.ScreenUpdating = False
For Each t In t ' si plusieurs cellules sont modifiées
Set r1 = Intersect(t.EntireRow, plage1)
Set r2 = Intersect(t.EntireRow, plage2)
Union(r1, r2).UnMerge 'défusionne
r1.HorizontalAlignment = xlCenterAcrossSelection
r2.HorizontalAlignment = xlCenterAcrossSelection
r1.WrapText = True: r2.WrapText = True 'renvoi à la ligne
r1.Rows.AutoFit 'ajustement automatiquement
h = r1.Rows.Height 'mémorise la hauteur
r1.Merge: r2.Merge 'refusionne
Union(r1, r2).HorizontalAlignment = align
If h < 409 Then r1.RowHeight = h 'hauteur de ligne
Next
End Sub