I am needing to add a variable range, per row starting in G2 (always) and carrying through the lastrow/lastcol -4 and then subtracting the value in the D column for each row & entering that result in lastcol-3. I've pieced this code together from other codes, and never used function.Sum, so I may be way off. Here is what I currently have for my code:
lastcol
is a number not a letter and Range, when using strings, expects letters.
Change to Cells():
sht.Cells(i,lastcol-3).Value = Application.WorksheetFunction.Sum(sht.Range(sht.Cells(i,7),sht.Cells(i,lastcol-4)))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.