Sub macro4()
Dim Paquetbis()
Dim i As Integer
Dim Premligne As Integer, Derligne As Integer
Dim Premcol As Integer, Derncol As Integer
Dim Paquetligne As Integer
Application.ScreenUpdating = False
ActiveCell.CurrentRegion.Select
Premligne = Selection.Row
Dernligne = Selection.Rows.Count + Premligne - 1
Premcol = Selection.Column
Derncol = Selection.Columns.Count + Premcol - 1
Paquetligne = Cells(Premligne + 1, Premcol).MergeArea.Rows.Count
For i = Premligne To Dernligne - 1 Step Paquetligne
If Cells(i + 1, Premcol + 1).Value <> "Total" Then Cells(i + 1, Premcol + 1).Select _
: MsgBox "La première ligne de ce groupe, en " & Cells(i + 1, Premcol + 1).AddressLocal & ", ne contient pas le mot Total" _
: Exit Sub
Next
For j = Premligne To Dernligne - 1 Step Paquetligne
Paquetbis = Range(Cells(j + 2, Premcol + 1), Cells(j + Paquetligne, Derncol)).Value
Range(Cells(j + 1, Premcol + 1), Cells(j + 1, Derncol)).Copy
Cells(j + Paquetligne, Premcol + 1).PasteSpecial xlValue
Range(Cells(j + 1, Premcol + 1), Cells(j + Paquetligne - 1, Derncol)) = Paquetbis
Next
Application.ScreenUpdating = True
End Sub