Xuân Thanh > 07-03-20, 08:01 AM
Sub TinhTong()
Dim rng As Range, Cot As Integer, Dong As Integer, n As Long, i As Integer
Dim rd As Integer, rc As Integer, cd As Integer, cc As Integer
Set rng = Selection
Cot = rng.Columns.Count
Dong = rng.Rows.Count
rd = rng.Row
rc = rd + Dong - 1
cd = rng.Column
cc = cd + Cot - 1
n = Range("A65000").End(xlUp).Row
For i = cd To cc
Cells(n + 1, i) = "=Sum(R" & rd & "C" & i & ":R" & rc & "C" & i & ")"
Next
End Sub