Consulting

Results 1 to 2 of 2

Thread: Why doesn't the xlcelltypelastcell not giving the last cell inside a list?

  1. #1

    Why doesn't the xlcelltypelastcell not giving the last cell inside a list?

    Why doesn't the xlcelltypelastcell not giving the last cell inside a list if all other enumerations working perfectly inside a list like visiblecells and all. What is the shortest way (best way) to locate the last cell inside a list.

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    What code are you using? When you say list, do you mean a list 2003 which is a table in 2007+ or do you mean a range? When you say last cell, do you mean last cell with data or last cell in the "list".

    Using the SpecialCells method:
    [vba]MsgBox Range("Table1").SpecialCells(xlCellTypeLastCell).Address[/vba]

    This finds the last cell empty or not in a range or a "Table".
    [VBA]With Range("Table1")
    MsgBox .Areas(.Areas.Count).Cells(.Areas(.Areas.Count).Rows.Count, 1).Address
    End With[/VBA]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •