View Single Post
 
Old 10-04-2020, 02:50 AM
leeqiang leeqiang is offline Windows 10 Office 2019
Advanced Beginner
 
Join Date: Aug 2020
Posts: 53
leeqiang is on a distinguished road
Default

Quote:
Originally Posted by Purfleet View Post
As long as the rows and columns are static, you just need to do a sum formula in the range without the fixed references

Sub sumtheall()

Columns("k:k").ClearContents
Rows("15:15").ClearContents

Range("a15:j15") = "=sum(a1:a14)"
Range("k1:k14") = "=Sum(a1:j1)"

End Sub
20201004174248.png


thanks for your help!
I have some questions about this code:
1.Range("a15:j15") = "=sum(a1:a14)" I don't understand the meaning of the code,what's the use of this method of sum?
2.This code does not calculate the sum of all the total data in row 15 and put it in cell K15. How to solve it?
Reply With Quote