need to find lastrow in "C" column dynamically

E

Excel-General

I need to get the lastRow dynamically because it can change. This is
not working but I don't know how to revise it. I want the last row in
column C.

lngLastRow = ws.Cells.Find(What:="*", After:=ws.Range("C1"), _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows).Row

This is in a macro and I set a watch on the variable and it was 1. It
looks like it is giving me the first column instead of the last
column.

tia,
 
E

Excel-General

I found the problem. What happens is the code is correct but the user
had the cells locked after it.
 
C

carlo

Hi tia

If you don't want to use find you could also use this:

IngLastRow = ws.cells(65536,3).end(xlup).row

which gives you the last row with an entry.

hth
Carlo
 
Top