ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find the last Cell in a column in VB (https://www.excelbanter.com/excel-programming/421189-re-find-last-cell-column-vbulletin.html)

Coder1215

Find the last Cell in a column in VB
 
Or more simply:

LastRow = range("C:C").SpecialCells(xlCellTypeLastCell).Row

regards


Gord Dibben

Find the last Cell in a column in VB
 
Which is not reliable if used range has not been re-set.

Enter data in column C down to row 100 then run the code which will return
100

lastrow = Range("C:C").SpecialCells(xlCellTypeLastCell).Row
MsgBox lastrow

Clear Contents from C51:C100 then run again.

You still get 100


Gord Dibben MS Excel MVP


On Thu, 11 Dec 2008 13:54:12 -0800 (PST), Coder1215
wrote:

Or more simply:

LastRow = range("C:C").SpecialCells(xlCellTypeLastCell).Row

regards




All times are GMT +1. The time now is 12:11 PM.

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