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