S Sayre Board Regular Joined Apr 12, 2005 Messages 180 Dec 4, 2005 #1 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?
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?
M MichaelRo Well-known Member Joined Jun 7, 2004 Messages 549 Dec 5, 2005 #2 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
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