Sub FindLastCell()
'*************************Locates the address of the last cell on a sheet that contains data
'*************************set the global variables myRange, LastColumn and LastRow
Dim LastCell As String
    If WorksheetFunction.CountA(Cells) > 0 Then
        'Search for any entry, by searching backwards by Rows.
        LastRow = Cells.Find(What:="*", After:=[A1], _
                    SearchOrder:=xlByRows, _
                    SearchDirection:=xlPrevious).Row
        'Search for any entry, by searching backwards by Columns.
                LastColumn = Cells.Find(What:="*", After:=[A1], _
                    SearchOrder:=xlByColumns, _
                    SearchDirection:=xlPrevious).Column
                LastCell = Cells(LastRow, LastColumn).Address
                myRange = "A2:" & LastCell
    Else
        myRange = "A2"
    End If
End Sub