find last row with data and copy all rows from bottom up?

Sayre

Board Regular
Joined
Apr 12, 2005
Messages
180
Can't seem to find a previous post that addresses this exactly.

I need some VBA code that will identify the last row with data in it on any given sheet and select all rows between it and the 1st row.

Any ideas?
 

Some videos you may like

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

MichaelRo

Well-known Member
Joined
Jun 7, 2004
Messages
549
Assuming Column A is the most populated column try:

Selects the whole row of the specified range:
Code:
Range(Range("A65536").End(xlUp).Row & ":" & Range("A1")).Select
Selects the range based on Column A being the most populated and Row 1 containing the most data:

Code:
Range(Cells(1, 1), Cells(Range("A65536").End(xlUp).Row, Range("IV1").End(xlToLeft).Column)).Select
 

Watch MrExcel Video

Forum statistics

Threads
1,118,290
Messages
5,571,327
Members
412,382
Latest member
Langtn02
Top