Macro question

Solved/Closed
Jay - Dec 27, 2009 at 10:44 PM
 Jay - Dec 28, 2009 at 10:07 AM
Hello,

I'm trying to write a macro in excel 07 to select the last row in a range. I want it to select the last row of the range only. Does anyone know how to do that?

For ex.

A3 = 5
A4 = 7
A5 = 9

I can obviously get the macro to specifically select row C, but if I add more rows or select rows, it will be off.

Thanks in advance!

2 responses

jaycr8965 Posts 1 Registration date Sunday December 27, 2009 Status Member Last seen December 28, 2009
Dec 28, 2009 at 01:01 AM
Oops sorry, meant I could select the row A5 is in. So basically want the macro to select the last row of data in a specific range.
0
Hi,

Try this line of code:
Range("A3").End(xlDown).EntireRow.Select


If you want to select the row below your range, i.e. the first empty row, try this:
Range("A3").End(xlDown).Offset(1, 0).EntireRow.Select


Best regards,
Trowa
0
Thanks Trowa! That's exactly what I needed.
0