ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert Grand total at the end (https://www.excelbanter.com/excel-programming/294638-insert-grand-total-end.html)

Payal[_2_]

Insert Grand total at the end
 
Hi, I am inserting grand total at the end of the result, which is
return by a query. I need to calculate from row 49. Its calculating
fine except for at L49 cell which is the first cell...its showing
total twice i.e. if the last row is 70...the total is shown at L71 and
L72...any idea what is wrong in the code??

Lastrowa = Range("b65536").End(xlUp).Row

Range("l49").End(xlDown).Offset(1, 0).Value = _
"=SUM(l49:l" & Range("l49").End(xlDown).Row & ")"

Set desti = Range("l" & Lastrowa + 1 & ":bo" & Lastrowa + 1)
Range("l" & Lastrowa + 1).Copy desti

Thanks
Payal

Grey Newt

Insert Grand total at the end
 
Hi

I've just built your code into a clean book - and your code works fine - placing the total once at the bottom of column L and then copying it to the right to column B

So - either you are using Excel 97, you are hitting the macro button twice, your code is inside a loop or the total is coming in from the import routine..




All times are GMT +1. The time now is 05:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com