need to find lastrow in "C" column dynamically

  • Thread starter Thread starter Excel-General
  • Start date Start date
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,
 
I found the problem. What happens is the code is correct but the user
had the cells locked after it.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top