I have a table with changing length of the rows and columns. I need to calculate the sums of the rows/columns/diagonal and write it in the next blank cell. I managed to do it for the columns but have no success with the other. Here is what I have:
Sub AutoSumCol()
Dim lngColumn As Long
Dim lngLastRow As Long
For lngColumn = 1 To Range("A1").End(xlToRight).Column
lngLastRow = Cells(1, lngColumn).End(xlDown).Row
Cells(lngLastRow + 1, lngColumn).Formula = "=Sum(" & Cells(1, lngColumn).Address & ":" & _
Cells(lngLastRow, lngColumn).Address & ")"
Next lngColumn
End Sub
Could you please help me with the other two sums...