View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default Last cell with data

..End(xlDown) is the same as selecting a cell, holding down the End key and
pressing the down key.
It will move down to the end of the current column's region, not the last
row containing data in that column.
It has it's uses when you have lists stacked on top of eachother.

If it's one list for the whole column, read on.

The following gets the first row up from the very last row in column
iColumnNo that contains data
Same as clicking cell A65536, holding down the End key and pressing the up
key.
i = Cells(Rows.Count, iColumnNo).End(xlUp).Row


"Tomek" wrote in message
...
try
Dim i as integer

i= Cells(iRowNo,iColumnNo).End(xlDown).Row

and You'll get the number of last row, in the given column, containing

data.
Or You may try
i=UsedRange.Rows.Count
and You'll get the number of last row containing any data in the whole
worksheet

"COM" wrote in message
...
Without looping through all the cells in a column, how can I determine

the
last cell that has data in it for a given column?