agieseke74
New Member
- Joined
- Aug 23, 2017
- Messages
- 2
I am creating a new macro to enable a custom report from a download we use on a bi-weekly basis. Initially, I recorded the macro. This has given me everything I need, except for my last piece. I need to find the last row, go one row down, and sum columns J, K, L, and M. Then in column "I" the word "Total" should be on that same row. Through the record feature, it wants static rows as part of the formula. I need it to be dynamic.
To be clear, I want to sum column J from J2:Jxxx, where xxx is the last row. The same holds true for columns K through M. Again, the number of rows will vary with each report we download.
I need to know how to write this. I have searched several forums and excel sites to get this, but nothing has worked. Also, can this be done in such a way that one set of code will cover all the columns, or will it have to be repeated for each column?
Here is the code I have (keep in mind this is a hodge-podge from trying out various helps I found on-line throughout the day):
<code>
EndRowI = Range(I65536).End(xlUp).Row
.Sheets(x).Range("I" & EndRowI + 1).Formula = "=SUM(I2:I" & EndRowI & ")"
EndRowH = Range("H" & Rows.Count).End(xlUp).Row
Range("H" & LR + 1).FormulaR1C1 = "Total"</code>
For what it's worth, the name of my sheet is "combined" which is an earlier step in my macro.
Thank you!
To be clear, I want to sum column J from J2:Jxxx, where xxx is the last row. The same holds true for columns K through M. Again, the number of rows will vary with each report we download.
I need to know how to write this. I have searched several forums and excel sites to get this, but nothing has worked. Also, can this be done in such a way that one set of code will cover all the columns, or will it have to be repeated for each column?
Here is the code I have (keep in mind this is a hodge-podge from trying out various helps I found on-line throughout the day):
<code>
EndRowI = Range(I65536).End(xlUp).Row
.Sheets(x).Range("I" & EndRowI + 1).Formula = "=SUM(I2:I" & EndRowI & ")"
EndRowH = Range("H" & Rows.Count).End(xlUp).Row
Range("H" & LR + 1).FormulaR1C1 = "Total"</code>
For what it's worth, the name of my sheet is "combined" which is an earlier step in my macro.
Thank you!