View Single Post
 
Old 10-03-2020, 11:11 PM
leeqiang leeqiang is offline Windows 10 Office 2019
Advanced Beginner
 
Join Date: Aug 2020
Posts: 53
leeqiang is on a distinguished road
Default How to optimize the data summation code for each row and column in a data rectangle area?

How to optimize the data summation code for each row and column in a data rectangle area?
20201004134211.png
The red area is the data. How to summarize the data of each column and each row in the 15th row and the kth column?
Book1.xlsm
How can the following code be optimized?thx
Sub sumtheall()
Dim i, j
Columns("k:k").ClearContents
Rows("15:15").ClearContents
For i = 1 To 10
For j = 1 To 14
Cells(15, i) = Cells(15, i) + Cells(j, i)
Next j
Next i

i = 1
j = 1
Do While Cells(j, i) <> ""
For i = 1 To 10
Cells(j, 11) = Cells(j, 11) + Cells(j, i)
Next i
j = j + 1
i = 1
Loop



End Sub
Reply With Quote