Sub Total()
Dim Derlig As Long, Dercol As Long, x As Long
Derlig = Sheets("Feuil1").Cells(Rows.Count, 1).End(xlUp).Row
Dercol = Sheets("Feuil1").Cells(1, Columns.Count).End(xlToLeft).Column
If Cells(Derlig, 1) = "TOTAL" And Cells(1, Dercol) = "TOTAL" Then
Derlig = Derlig - 1
Dercol = Dercol - 1
Else
Cells(Derlig + 1, 1) = "TOTAL"
Cells(1, Dercol + 1) = "TOTAL"
End If
For x = 2 To Dercol
Cells(Derlig + 1, x) = WorksheetFunction.Sum(Range(Cells(1, x), Cells(Derlig, x)))
Next x
For x = 2 To Derlig + 1
Cells(x, Dercol + 1) = WorksheetFunction.Sum(Range(Cells(x, 2), Cells(x, Dercol)))
Next x
End Sub