ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   select last cell in used range (https://www.excelbanter.com/excel-programming/287033-select-last-cell-used-range.html)

Tony P

select last cell in used range
 

Hi all,

How do I select the last (right, bottom) cell in a used
range.

Have played with the Range(ActiveSheet.UsedRange.Cells
(?).Address).Select - with no luck.

Any help would be appreciated.

Tony.

david mcritchie

select last cell in used range
 
Hi Tony,

Short snippet example:
Dim lastcell As Range
Set lastcell = Cells.SpecialCells(xlLastCell)
lastcell.EntireRow.Select

The following single line of code should do what you asked:

cells.specialcells(xlLastCell).activate

--
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Tony P" wrote in message ...

Hi all,

How do I select the last (right, bottom) cell in a used
range.

Have played with the Range(ActiveSheet.UsedRange.Cells
(?).Address).Select - with no luck.

Any help would be appreciated.

Tony.





All times are GMT +1. The time now is 11:34 AM.

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