View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default 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