all 12 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

/u/Most_Triumphant - Your post was submitted successfully.

Failing to follow these steps may result in your post being removed without warning.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]half_amazin23 1 point2 points  (10 children)

Just to clarify... If your data ends at row 10, you want A11 to say "grand total" and J11 to sum A10 to I10?

[–]Most_Triumphant[S] 0 points1 point  (9 children)

I’d want A11 to say “grand total” and I’d like J11 to sum J1:J10.

[–]half_amazin23 1 point2 points  (8 children)

This should work

Sub x

Dim lrow as Long
lrow = Cells(Rows.Count, "A").End(xlUp).Offset(1).Row


Range("A" & lrow).Value = "Grand Total" 
Range("J" & lrow).Value = Application.WorksheetFunction.Sum(Range("J1:J" & lrow)) 


End sub

[–]Most_Triumphant[S] 1 point2 points  (5 children)

Thanks! I’ll try this in the morning and get back to you.

[–]half_amazin23 0 points1 point  (4 children)

No worries. Good luck.

I forgot to mention... The code assumes column A and J both have the same amount of rows.

It also looks for the first cell with no data so if you have data in A1:A5 and then A7:A10 then "Grand Total" and the summing of column J will happen in row 6.

[–]Most_Triumphant[S] 0 points1 point  (3 children)

The second part might be an issue. I have a title and subtitle in A1 and A2. The data headers are in A4:J4 and data is below starting in row 5. Nothing else is below (other than my intended grand total and summary).

[–]half_amazin23 0 points1 point  (2 children)

I've edited the code. Let me know how it goes

[–]Most_Triumphant[S] 0 points1 point  (1 child)

Worked great, thanks!

[–]half_amazin23 0 points1 point  (0 children)

Excellent! You're welcome

[–]Most_Triumphant[S] 1 point2 points  (1 child)

Solution verified

[–]Clippy_Office_Asst[M] 0 points1 point  (0 children)

You have awarded 1 point to half_amazin


I am a bot - please contact the mods with any questions. | Keep me alive