Bonjour oly111,
à tester,
Sub test()
'je vous laisse le soin de déclarer les variables
Application.DisplayAlerts = False
fin = Cells(Rows.Count, 1).End(xlUp).Row
For i = fin To 2 Step -1
n = n + 1
If Cells(i, "A") = Cells(i - 1, "A") Then
deb = fin - n
Else
If Cells(i, "A") <> Cells(i + 1, "A") Then deb = fin
d = Range(Cells(deb, 1), Cells(fin, 1)).Address
Debug.Print Range(Cells(deb, 1), Cells(fin, 1)).Address
With Range(Cells(deb, 1), Cells(fin, 1))
.WrapText = True
.MergeCells = True
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With
fin = fin - n
n = 0
End If
Next
Application.DisplayAlerts = True
End Sub
Édit:
ps/les lignes suivante ont été utile au test uniquement
' d = Range(Cells(deb, 1), Cells(fin, 1)).Address
' Debug.Print Range(Cells(deb, 1), Cells(fin, 1)).Address
elles peuvent être éliminées.