Do you mean last cell used in a particular column in a particular sheet?
in this case i was looking for a column , but it would be nice to know how to do the sheet also
If, say, column A in Sheet1 is a column where you enter numeric data frequently, the formula that follows will give you the row number of the last in use in A:
=MATCH(9.99999999999999E+307,A:A)
One caveat. The column must not have a number as big as 9.99999999999999E+307, unless a single instance of it is in the last cell.
=ADDRESS(MATCH(9.99999999999999E+307,A:A),1)
will give you the reference of the last cell in use in A ('1' in the formula is the column number of A).
If the above is not satisfactory, use the following UDF that I've stolen & modified a bit. You need to insert this in a module in your workbook after activating Visual Basic Editor.
Function ENDCELL(rng As Range)
Dim WorkRange As Range
Dim i As Integer, CellCount As Integer
Application.Volatile
Set WorkRange = rng.Columns(1).EntireColumn
Set WorkRange = Intersect(WorkRange.Parent.UsedRange, _
WorkRange)
CellCount = WorkRange.Count
For i = CellCount To 1 Step -1
If Not IsEmpty(WorkRange(i)) Then
LASTINCOLUMN = WorkRange(i).Address
Exit Function
End If
Next i
End Function
Usage:
=ENDCELL(A:A)
This will produce the address/reference of the last cell in use in A.
Hope this helps.
Aladin