How to get last row used in sheet DATA

A

alainB

Hi,

Just saw this code a few hours ago but can't find it back

The code will tell me that there is that many row used in the sheet
From that info, I will be able to put my next line of data.

Thanks

Alai
 
A

alainB

Hi,

It is not what I saw.

Was very simple, maybe less than 30 letters. I think it is to give th
number of rows used in the sheet.

Thanks

Alai
 
R

Rob van Gelder

UsedRange is alright, as long as you know it's not always going to be the
"real" last row until you've saved.

Alain, maybe it's:
lngLastRow = ActiveSheet.Range("A65536").End(xlUp).Row
That determines the last row based on the last entry in column A
 
A

alainB

Hi,

Thanks.

Almost that Frank!

x= Sheets("DATA").UsedRange.Rows.Count
Msgbox x

It gives me what I need.

Thanks everybody.

Alai
 
S

SidBord

Perhaps you could use a variation of one of these:
=Offset(A1,CountA(A:A)-1,0)
OR my personal favorite:
Selection.End(xlDown).Select
This finds the last non-empty cell.
 
Top