macro to find out the last cell in a range

V

vikram

i have a column which has a total in the end but the number of rows i
that column varies. I want a macro that gives me the total in a cell
specify in the same worksheet

please help!
thank
 
D

Don Guillett

You don't need vba for this. Just use INDIRECT where 16 is in cell g1 to sum
d1:d16
=SUM(INDIRECT("D1:D"&G1))
 
B

brianwa

This formula will return the last value in a column. (as is, down to ro
40)

=INDEX($P:$P,(MAX(($P$1:$P$40<>"")*(ROW($P$1:$P$40)))))

Array entered CTRl + Shift +Enter

B
 
Top