Sub report()
pref = Array("FD", "ZD", "FA", "ZA")
num = 1
For n = 2 To Range("A65536").End(xlUp).Row
For m = 2 To 5
Cells(n, m) = pref(m - 2) & "-" & num & "-" & Cells(n, m)
Next m
If Range("A" & n + 1) = Range("A" & n) Then
num = num + 1
Else
num = 1
End If
Next n
'Exit Sub
ligne = 2
AA = Range("A65536").End(xlUp)
For n = Range("A65536").End(xlUp).Row To 2 Step -1
If Range("A" & n - 1) = AA Then
col = Range("IV" & n - 1).End(xlToLeft).Column + 1
lim = Range("IV" & n).End(xlToLeft).Column
Range(Cells(n, 2), Cells(n, lim)).Copy Destination:=Cells(n - 1, col) Rows(n).Delete
Else
AA = Range("A" & n - 1)
End If
Next n
Range("A1").Copy
For n = 1 To ActiveSheet.UsedRange.Columns.Count
Cells(1, n) = lettre(n) & lettre(n)
Cells(1, n).PasteSpecial Paste:=xlPasteFormats
Next n
Application.CutCopyMode = False
End Sub
Function lettre(colonne)
lettre = Replace(Cells(1, colonne).Address(0, 0), "1", "")
End Function