ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Extra rows with no data (https://www.excelbanter.com/excel-programming/285060-extra-rows-no-data.html)

mike

Extra rows with no data
 
Hi. I am using the following line to select a range from
the active cell down to the last cell in the file. My
problem is that I want this to go to the last cell THAT
HAS DATA. There are several rows below this last cell
that are somehow recognized as being part of the range.
Is there either a way to delete the rows or to instruct
the macro to go to the last cell with data?

Range(Selection, ActiveCell.SpecialCells
(xlLastCell)).Select

Thanks,
Mike.

Bill Manville

Extra rows with no data
 
Mike wrote:
My
problem is that I want this to go to the last cell THAT
HAS DATA. There are several rows below this last cell
that are somehow recognized as being part of the range.
Is there either a way to delete the rows or to instruct
the macro to go to the last cell with data?

Range(Selection, ActiveCell.SpecialCells
(xlLastCell)).Select


Try:

Range(Selection, ActiveSheet.UsedRange.SpecialCells
(xlLastCell)).Select

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup



All times are GMT +1. The time now is 07:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com