ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   putting count of the number of rows at the bottom (https://www.excelbanter.com/excel-programming/359383-putting-count-number-rows-bottom.html)

lpdarspe

putting count of the number of rows at the bottom
 
I have the following lines in a macro that puts the sums of number in column
J at the bottom of all the rows. I want to put the count of rows on the same
row as the sums for column J, but in column D. How do I do that?

lastrow = Cells(Rows.Count, "J").End(xlUp).Row
Cells(lastrow + 1, "J") = Application.Sum(Range(Cells(2, "J"),
Cells(lastrow, "J")))


macropod

putting count of the number of rows at the bottom
 
Hi lpdarspe,

Try:
..Cells(lastrow, 4).Value = lastrow

Cheers


"lpdarspe" wrote in message
...
I have the following lines in a macro that puts the sums of number in

column
J at the bottom of all the rows. I want to put the count of rows on the

same
row as the sums for column J, but in column D. How do I do that?

lastrow = Cells(Rows.Count, "J").End(xlUp).Row
Cells(lastrow + 1, "J") = Application.Sum(Range(Cells(2, "J"),
Cells(lastrow, "J")))




lpdarspe

putting count of the number of rows at the bottom
 
macropod,

That did not work. It overwrote the data on the last row in column D.

"macropod" wrote:

Hi lpdarspe,

Try:
..Cells(lastrow, 4).Value = lastrow

Cheers


"lpdarspe" wrote in message
...
I have the following lines in a macro that puts the sums of number in

column
J at the bottom of all the rows. I want to put the count of rows on the

same
row as the sums for column J, but in column D. How do I do that?

lastrow = Cells(Rows.Count, "J").End(xlUp).Row
Cells(lastrow + 1, "J") = Application.Sum(Range(Cells(2, "J"),
Cells(lastrow, "J")))






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

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