Option Explicit
Sub Mise_En_Forme()
Dim F As Worksheet, nb As Integer, i As Integer, tb
Set F = ThisWorkbook.Sheets("activite_agent (2)") '**nom feuille à adapter**
With F
.Rows(1).Delete
nb = .Cells(Rows.Count, 3).End(xlUp).Row
For i = nb To 2 Step -1
If .Cells(i, 3) <> "TOTAL" Then .Rows(i).Delete
Next i
nb = .Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To nb
If .Cells(i, 3).MergeCells Then .Cells(i, 3).UnMerge
If .Cells(i, 19).MergeCells Then .Cells(i, 19).UnMerge
If .Cells(i, 3).Offset(0, -2) = "Chalons" Then .Cells(i, 3).Offset(0, -2) = "CNMR"
If .Cells(i, 3).Offset(0, -2) = "Clermont" Then .Cells(i, 3).Offset(0, -2) = "CNMR"
tb = Split(.Cells(i, 3).Offset(0, -2), "_")
If UBound(tb) <> 0 Then .Cells(i, 3).Offset(0, -2) = tb(UBound(tb))
Next i
.Columns("T:U").Delete Shift:=xlToLeft
End With
MsgBox "Traitement terminé!"
End Sub