Last cell display

H

Haldun Alay

Hi,

Following code will help you.

Regards.


Haldun Alay

Function LastUsedRange(SheetName As String) As String
Application.Volatile True
Dim Wks As Worksheet
On Error Resume Next
Set Wks = Worksheets(SheetName)
If Err.Number <> 0 Then
Err.Clear
LastUsedRange = "Sheet not exist!"
End If
LastUsedRange = Wks.UsedRange.Address(rowabsolute:=False,
columnabsolute:=False)
End Function
 
A

Aladin Akyurek

Also...

For a text-valued column...

=LOOKUP(REPT("z",255),A:A)

would retrieve the last text value from A.

For a numeric column...

=LOOKUP(9.99999999999999E+307,A:A)

would retrieve the last numeric value (number, date, time) from A.
 

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

Top