View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
lpdarspe lpdarspe is offline
external usenet poster
 
Posts: 23
Default 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")))