Sub test()
Dim a As Range, b As Range, c As Range, i&
Application.ScreenUpdating = False
[A:A].Replace "TOTAUX", "#N/A"
Set a = [A:A].SpecialCells(xlCellTypeConstants, 16)
a = "TOTAUX"
Cells.Replace "COMMANDES", "#N/A"
Set b = Cells.SpecialCells(xlCellTypeConstants, 16)
b = "COMMANDES"
Set c = Intersect(b.EntireRow, [A:A])
For i = 1 To a.Count
Intersect(a.Areas(i).EntireRow, b.EntireColumn).FormulaR1C1 = _
"=SUM(R[" & c.Areas(i).Row - a.Areas(i).Row & "]C:R[-1]C)"
Next
End Sub