D
dhstein
What is the code to find the last entered cell in a column? Thanks for any
help you can provide.
help you can provide.
Rick Rothstein said:This will set a reference to the last cell in Column C on the active sheet.
Dim LastCell As Range
Set LastCell = Cells(Rows.Count, "C").End(xlUp)
If you want to reference the last cell on a specific sheet...
Dim Last Cell As Range
With Worksheets("Sheet1")
Set LastCell = .Cells(.Rows.Count, "C").End(xlUp)
End With
Note the dotted Cells and Rows property calls to reference the sheet in the With statement.
--
Rick (MVP - Excel)
Rick, Thanks so much for your response. I have to try it now. But I realize that I may need something else, because this is part of a routine that will read in a file each day into a fixed location. One day the file may go to row 1000 and the next day it may go to row 1050 or 950. So I wonder if that function will work in that case or will it show the maximum cell that was ever used? In that case I would probably need the last Nonblank cell in the row. Thanks for any information on this.
JLGWhiz said:In Excel2003 it will max out at 65535 because the row count is 65536. In
Excell2007, there are considerably more rows and you probably would not have
any problem for quite a while.