Leeqiang
This is why you need to ask the full question at the begining - in your orginal post you said the 15th row and Column K, so i assumed the grid was static.
If you want to work out varible rows and columns try this - there might be neater or nicer ways but you dont need a loop to sum
Sub sumtheall()
Dim LR As Integer
Dim LC As Variant
Dim LRSum As Integer
Dim LCSum As Variant
'Find last row
LR = Cells(Rows.Count, 1).End(xlUp).Row + 1
LRSum = LR - 1
'Find last column
LC = Cells(1, Columns.Count).End(xlToLeft).Column + 1
'Change column to Letter
LCSum = Chr(LC + 64 - 1)
LC = Chr(LC + 64)
'Input Sum
Range("a" & LR & ":" & LC & LR) = "=sum(a1:a" & LRSum & ")"
Range(LC & "1:" & LC & LR) = "=Sum(a1:" & LCSum & "1)"
End Sub
|