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")))